s-ol’s Twitter Archive
—№ 1,341
⇤ Newest
Tweet
⇠ Newer
Tweet
Older
Tweet
⇢
another #reactjs helper (copy&paste below), this time for consuming multiple contexts and forwarding them as named properties:
Permalink
On twitter.com
2019 Apr 16
Mood
0
…in reply to @S0lll0s
const consumeMultiple = (WrappedComponent, contexts) => contexts.reduce( (inner, [name, Context]) => (args) => ( <Context.Consumer> {value => inner({ ...args, [name]: value })} </Context.Consumer> ), (args => <WrappedComponent {...args} />) );
On twitter.com
2019 Apr 16
Mood
0