I expect the props to appear from the repository named GetDealersStore , and the way I get the data with the action in which I do this:
componentWillMount () { GetDealersActions.getDealers(); }
I have already tested the application, and componentWillMount() works until the initial rendering, where I have this
let dealerInfo; if (this.state.dealerData) { dealerInfo = this.state.dealerData.dealersData.map((dealer) => { return (<div>CONTENT</div>); }) } else { dealerInfo = <p>Loading . . .</p> }
but for the first second you can see <p>Loading . . .</p> <p>Loading . . .</p> <p>Loading . . .</p> on the screen, which is else in the conditional expression above, and then return (<div>CONTENT</div>); appears in the rest of the rendering return (<div>CONTENT</div>); , which is if in conditional, So I think it means the render method was a trigger because it continues to wait for data coming from the database.
Data from the database is not available during the 1st rendering, so how can I get this data before the first initial rendering?
source share