React question detail
What happens if you call `useState` conditionally?
As per rules of React Hooks, hooks must be called unconditionally. For example, if you conditionally call it:
if (someCondition) {
const [state, setState] = useState(0);
}
React will throw a runtime error because it relies on the order of Hook calls, and conditional logic breaks that order.