Skip to content

not sure how I can "setState" #735

Closed Answered by dai-shi
Ofer-Gal asked this question in Q&A
Discussion options

You must be logged in to vote

Does it really populate state.columnsState with the value of localColumnsState ?

I think it does. Does it not?

Should I create a method in the store to populate the property?

It's up to you. Both styles work: https://github.com/pmndrs/zustand/wiki/Practice-with-no-store-actions

How would I do it with a parameter?

You can create a function or a method to take a parameter.

export const setColumnState = (columnState) => {
  useGridStore.setState({ columnsState })
}

Or, you mean something else.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Ofer-Gal
Comment options

Answer selected by Ofer-Gal
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
Converted from issue

This discussion was converted from issue #734 on January 02, 2022 00:33.