This document covers the details of a component that needs to fetch required data before rendering. In our imaginary app we're using react, redux, and react-router. We're covering the specific use-case of a detail page that gets its id from the URL.
- URL contains an ID, it is matched by a route like
<Route path="/detail/:id" component={View} />, which renders our<View /> - The
<View />component receivesmatchin props. Thematchprop contains the ID inmatch.params.id. - The
<View />component renders some<MyContainer id={match.params.id} />component with anidprop. - The
<MyContainer id={match.params.id} />container selects values from the state as props and passes them to the wrapped<My />component. - When
<My />component's lifecycle encounterscomponentWillMountorcomponentWillReceiveProps, it calls anonBeforeRenderfunction (passed in frommapDispatchToPropsby<MyContainer />) - Then `` dispatches a