useState()
↔ Stateful Hook to persist single state value in FC
const [_value, _setter] = useState(initial)
Lazy Initial value
function pass as Parameter into useState()
, to assign return
value as Initial State value, on first-call only
!flow diagram of useState in simple counter
References
Lazy Initial value
↔ function pass as Parameter intouseState()
, to assignreturn
value as Initial State value, on first-call onlyTS infers type "never" for init {} or [] in [**_
useState()_**](usestate)
↔
Type 'string' is not assignable to type 'never'.ts(2322)