DEV Community

Discussion on: You probably don't need Redux: Use React Context + useReducer hook

Collapse
 
nikhilkumaran profile image
Nikhil Kumaran S

You can declare an async function in the value prop to the Provider. Here's an example: codesandbox

P.S. Not sure if this exactly what you asked for.

Collapse
 
sylvestertarnowski profile image
Sylvester

Yes, this is it. It occurred to me when I saw the example that I don't need middleware to access state - here I can simply refer to it if I need for example some intersection between fetched data and current state.

Thank you :-)

Thread Thread
 
nikhilkumaran profile image
Nikhil Kumaran S

You're welcome👍🏽