Hi I'm new to react/redux. I started playing around with the React-Redux template in Visual Studio 2017. I want to load a left navigation that is common to the UI. The left navigation needs to call an API to populate. I don't really want to include it in {this.props.children}. What's the best way to do this in react-redux?
j
stuff ;)
this is a so called "sideffect". there is
* redux-thunk
besides that's based on your component architecture there are different approaches.
you could for example create a closure
const async DoApiCall(param) { await doMyPromiseThing.then((responseData) => { return responseData; }) }that assign it to an internal state of the component. if you use redux usually you should assign it to a store but that means middle ware and event interceptions.
aka sideeffects. I personally use saga but you could use redux observable as well.