4 ms·
Wouldn't you just wire up Button Press -> State -> Shopping Cart View Just have the state have a function for dispatching a change to the shopping cart which
by thomashop 5y ago
Wouldn't you just wire up
Button Press -> State -> Shopping Cart View
Just have the state have a function for dispatching a change to the shopping cart which is passed to the button component and pass the actual state to the shopping cart view.
You can have the state live in a parent component, use redux, use context or go more hacky.
- nemothekid 5y ago>live in a parent component, use redux, use context or go more hacky. My initial reading of OP's post is that this is the "hack" he doesn't like (even Context wasn't all that encouraged in React IIRC). My amusement, however, is this is, to him, a fundamentally philosophical disagreement with the design of React