I don't understand the implementation of React Con...
# javascript
r
I don't understand the implementation of React Context in the wrapper. How do you get the
dispatch
function?
useContext
only returns the state
Maybe I need to call
useReducer
in all components that need to be able to update the context's state?
I don't get why the example doesn't do the most basic thing, changing the state https://github.com/JetBrains/kotlin-wrappers/blob/master/examples/src/main/kotlin/example/main.kt
n
iirc to set state you do your state changes in
useState { exampleToggle = true }
that is without redux or such
r
useState
is local to a component, a context can be retrieved from anywhere in the hierarchy (basically replaces Redux)