Is it possible to know if it's the first rendering?
danieldhp opened this issue · 2 comments
I'm migrating from connected-react-router
and it has a feature that on the first rendering, the LOCATION_CHANGE
action has a property named isFirstRendering
. Is there a feature similar to this?
Thanks
Hi @danieldhp, redux-first-history does not depend on react rendering lifecycle, it sync state with history since his creation, so there is no first render.
https://github.com/salvoravida/redux-first-history#main-features
I should be simple add a flag for first location action dispatch here, https://github.com/salvoravida/redux-first-history/blob/master/src/actions.ts#L17
But I think it is useless.
What's your use case?
I was using this is a few places to trigger actions that should only happen (or should not happen) on first page load (loading data, authentication etc) but I managed to replace the behaviour by using (rxjs) first()
operator and skip(1)
to take or ignore the first location change action.