I'm not sure if I understand your question, but React.useState returns two values in the form of an array. The first is the state value, which should be treated as immutable and the second is a setter function, which is used to update the state value.
Oh, right. No, it doesn't return a useful value (undefined). However, it does automagically update the value of the state variable and cause your component to rerender with that new value.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm not sure if I understand your question, but
React.useState
returns two values in the form of an array. The first is the state value, which should be treated as immutable and the second is a setter function, which is used to update the state value.More info here: reactjs.org/docs/hooks-state.html
Does the setter function return a value? You know, in addition to setting one
Oh, right. No, it doesn't return a useful value (
undefined
). However, it does automagically update the value of the state variable and cause your component to rerender with that new value.