const newState = { ...state, config: { climate: !state.config.climate, speed: state.config.speed, temperature: state.config.temperature, wheels: state.config.wheels } };
Building Tesla’s Battery Range Calculator with React (Part 2: Redux version)
Matthew Choi
2123

How about

state.config.climate = !state.config.climate;
const newState = {…state, config: state.config};

Isn’t that more readable?

Edit: If you are using something like immutable.js that might be an issue but the following should work:

const config = {…state.config, {climate: !state.config.climate}};
const newState = {…state, config};
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.