unirakun / k-redux-router

redux router (with react bindings) - one route = one code
8 stars 1 forks source link

:recycle: replace componentWillMount by componentDidMount #78

Closed bpetetot closed 3 years ago

bpetetot commented 4 years ago

With new version of react componentWillMount is deprecated, and will be removed in the next major version. So I changed it by the componentDidMount which seems correct because component will be mounted but not displayed by default (with state show=false), then once mounted it will the correct test.

It avoids lot of annoying messages in the console in dev mode. Here in the conference hall project: image

If you dont agree to replace it by componentDidMount, we can simply replace it by UNSAFE_componentWillMount. But it wont be future proof.

fabienjuif commented 4 years ago

The difference will be that the component will be rendered twice insteaf of once (the HoC). Do you agree?

That being said I don't think this is a big performance issue since the wrapped component is not rendered, and I don't know if we will see clipping.

Did you test this modification locally?

bpetetot commented 3 years ago

Too old I close it ;)