Skip to content

updateTrigger does not work with react state #5989

Answered by Pessimistress
hoang-ta asked this question in Q&A
Discussion options

You must be logged in to vote

Not sure what you are trying to accomplish by using state here. But when you call useState(layer), layer is the initial state, i.e. the value is only read the first time it's called. After that you need to call setLayerState to change layerState.

https://reactjs.org/docs/hooks-state.html#declaring-a-state-variable

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@Pessimistress
Comment options

@Pessimistress
Comment options

@hoang-ta
Comment options

@Pessimistress
Comment options

@hoang-ta
Comment options

Answer selected by hoang-ta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants