I am new to react Hooks! Am trying to make use of useState in my code. While I was using it I found a term "Lazy initial state"
const [state, setState] = useState(() => {
const initialState = someExpensiveComputation(props);
return initialState;
});
But I am not able to think of any useCase where this lazy initializing of state will be useful!
Like say am my DOM is rendering and it needs the state value, but my useState has not yet initialized it yet!! And say if you have rendered the DOM and the useState ExpensiveComputation has finished will the DOM will re-render !!
Any help would be useful!
!!? is!not enough? and what about humble.? - marzelin