In this example, we are going to create a simple list of notes where, every 10 seconds, we will simulate that we receive an update from the service with new data, and with componentWillReceiveProps, we will register the last time we got an update from the server:
- The componentWillReceiveProps method is called right before rendering. Like shouldComponentUpdate, it is called whenever new props are passed to the component, or the state has changed. In this example, we need to create fake data, but data normally needs to come from an actual service:
export const notes1 = [ { title: 'Note 1', content: 'Content for Note 1' }, { title: 'Note 2', content: 'Content for Note ...