Open
Description
Here's a use case. I think the API would be really nice.
import { State } from './state.provider';
const Parent = () => {
const { handleAction, currState, component: Component } = State.useContainer();
return (
<Component sendAction={handleAction} pollData={pollData} />
);
};
export default State.withContainer(Parent);
Without the above, you need to do this everytime you create a new state:
import { State } from './state.provider';
const withContainer = (Component) => (props) => (
<State.Provider>
<Component {...props} />
</State.Provider>
);
const Parent = () => {
const { handleAction, currState, component: Component } = State.useContainer();
return (
<Component sendAction={handleAction} pollData={pollData} />
);
};
export default withContainer(Parent);
Metadata
Metadata
Assignees
Labels
No labels