Answer the question
In order to leave comments, you need to log in
Redux toggle how to implement?
Good evening. Started studying with Redax. And there is a simple task - toggle.
There is a parent that, when true, fulfills one condition, and when false, another. And there is a component (at a distance from the parent, for example, 2-3 components), which should determine these bool - values. I.e. If we clicked on the button in this remote component, then state = !state, in general, a state switch. And I do not quite understand how to implement this.
I looked at the example https://codepen.io/cassiecodes/pen/VKZqBd
But I did not quite understand how to do this so that the parent "listens" to what is happening in the remote child. Chaining through components?
Tell me please :(
Answer the question
In order to leave comments, you need to log in
To solve your problem, in a good way, redux is not needed. If you purposefully want to implement using redux, then rewrite the example from the link line by line and try to parse it. If it doesn't work - study the documentation, you seem to have begun to study it. If you have specific questions besides "I don't understand anything", ask.
Might be useful to someone.
You need to return the new changed state in its entirety.
More details https://stackoverflow.com/a/40701007/9927320
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question