Crypto coins exchanger – implementing shouldComponentUpdate

Today, everyone is talking about Bitcoin, Ethereum, Ripple, and other cryptocurrencies. Let's create our own Crypto Coins Exchanger to learn how shouldComponentUpdate works.

Our exchanger will look like this:

  1. We'll sell entire coins. That means we won't trade with decimals; everything should be an integer, and each currency costs $10 dollarsOur code is simple, so let's take a look:
import React, { Component } from 'react';import './Coins.css';class Coins extends Component {  constructor() {    super();    // Initial state...    this.state = {      dollars: 0    };  }  shouldComponentUpdate(props, ...

Get React Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.