Container.js

The Container component holds several other components, toggles components display as per state changes, and passes down their props to the components after it receives them from app.js:

  1. We start by importing React and all of the dependent components.
You can look at the Container component code file at the following GitHub repository for reference: https://github.com/PacktPublishing/Blockchain-Development-for-Finance-Projects/blob/master/Chapter%202/Chapter%202/tokenwallet/src/Components/Container.js. 
  1. The container checks the current state selected by the user. Accordingly, the user is navigated to the correct screen components. The state is checked using the transferDetail20, transferDetail721, mintDetail20, mintDetail721, approveDetail20, and approveDetail721 state variables. The container then redirects the props it receives from app.js to the relevant component and renders it.
  2. If the state variable is not set for an operation (approve, mint, or transfer), the container then renders the default token block. 
  3. The container also renders a separate panel for ERC721 tokens. 

Next, let's look at our App.js file.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.183.14