Timeline for React.js, pulling data from api and then looping through to display
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 11, 2018 at 6:01 | vote | accept | born2gamble | ||
| May 11, 2018 at 5:49 | comment | added | born2gamble | Looks like I need to read more on lifecycles. I was under the impression that componentWillMount would run before render. I am updating the empty data state, with the api response data inside the componentWillMount area. | |
| May 11, 2018 at 5:46 | history | edited | born2gamble | CC BY-SA 4.0 |
added 83 characters in body
|
| May 11, 2018 at 2:21 | answer | added | Tal Goldfus | timeline score: 2 | |
| May 11, 2018 at 1:37 | answer | added | Pankaj Parkar | timeline score: 1 | |
| May 11, 2018 at 1:34 | comment | added | Andrew Li |
Before your data comes in, it's just a string. A string does not have the property hits. You should check it exists before you map over it or set initial state to data: { hits: [] }
|
|
| May 11, 2018 at 1:33 | history | asked | born2gamble | CC BY-SA 4.0 |