Animating programmatically with Redux and React
tech.instacart.com
Animating programmatically with Redux and React
1–4 of 4 posts
Re: Animating programmatically with Redux and React
#2 window.addEventListener(
'resize',
()=>store.dispatch({
type: 'WINDOW_RESIZE'
})
);
window.addEventListener(
'scroll',
()=>store.dispatch({
type: 'WINDOW_SCROLL'
})
);
NOTE: you should double-check your scroll position, as the scroll events continue to fire as you hit the edge of the viewport.Re: Animating programmatically with Redux and React
#3I've taken a different approach for similar needs in the past... I have the current window size and scroll position in my state, and have windows events for resize/onscroll update said values... from there, I can have pure rendering that uses the values... Also, but centralizing the size/position values, I can have multiple components that handle their rendering as appropriate internally. window.addEventListener( 're…
Re: Animating programmatically with Redux and React
#4I've taken a different approach for similar needs in the past... I have the current window size and scroll position in my state, and have windows events for resize/onscroll update said values... from there, I can have pure rendering that uses the values... Also, but centralizing the size/position values, I can have multiple components that handle their rendering as appropriate internally. window.addEventListener( 're…
Very cool. We do something very similar on Instacart's site. Our main Redux store and header component track window size and scroll position so that all components on the site have that info and can react to if they need. Works wonderfully!
I'm still curious as to when/if we may see the likes of aphrodite really take off.