Don’t know what to google to get documentation and understand what I’m seeing :
Source is in React docs, declaring a state variable : https://reactjs.org/docs/hooks-state.html#declaring-a-state-variable
Here is the Syntax : const [count, setCount] = useState(0)
What is this way of declaring a const called?
useState is one of build-in react hooks available in
useState should be used only inside functional components.
useState is the way if we need an internal state and don’t need to implement more complex logic such as lifecycle methods.
const [state, setState] = useState(initialState);
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.