Plan and done for May-27-2018

What will I learn today?

FreeCodeCamp React projects: Camper Leaderboard.

Done

Challenges

  1. I want to use async/await for fetching data but what about catching errors?
  2. When and where to fetch initial data to React app?

Solutions

  1. Here is the receipt to do it with style:
function to(promise) {
  return promise.then(data => {
      return [null, data];
    })
    .catch(err => [err]);
}
  1. The right place is componentDidMount. An explanation - Initial data via AJAX.