"Shawn, now let's start taking a look at how to dynamically fetch data from https://openlibrary.org/, store it in our component, and render it after making it compatible to render.
A component goes through different life cycle events. They help facilitate when we should initialize which part of a component or when should some external data be fetched.
We have already seen some of these methods such as render
, getInitialState
, and getDefaultProps
.
An updated detailed list and example for the same can be found at http://videos.bigbinary.com/react/react-life-cycle-methods-in-depth.html.
Let's go through each of these, one by one, and how they can be used so that we can start fetching dynamic information for display. Here is a list of methods that we will discuss:
componentWillMount
componentDidMount
componentWillReceiveProps(object nextProps)
boolean shouldComponentUpdate(object nextProps, object nextState)
componentWillUpdate(object nextProps, object nextState)
componentDidUpdate(object prevProps, object prevState)
componentWillUnmount()
React.unmountComponentAtNode(document.body)
You can follow along the next example at http://jsbin.com/tijeco/3/edit.