4 ms·
To do 'componentDidMount' you simply need a 'useEffect' with an empty (non-null) dependency array. It makes sense to me - maybe the issue is more familiarity th
by ArchReaper 7y ago
To do 'componentDidMount' you simply need a 'useEffect' with an empty (non-null) dependency array. It makes sense to me - maybe the issue is more familiarity than simplicity?
Edit: useEffect performs a side effect every time one of it's dependencies has changed value. Passing an empty array means the effect is only run once (on mount) because there are no dependencies.