Building the container component

The container component has a fairly straightforward logic. It accepts the current state of the app from the app.js file. It checks the current value of the account state variable to see whether its value is not null, indicating the customer has successfully logged in to the app. If the value is null, the container renders the AppLogin.js component so that the user can log in.

If the account variable is not null, the container component next checks the ViewFlag state variable. If ViewFlag is set to 1, it indicates that the Transfer.js component needs to be rendered. If ViewFlag is set to 2, it indicates that the ViewTransactions.js component needs to be rendered.

Depending on the value of the ViewFlag state variable, the container component renders the Transfer.js or the ViewTransactions.js component and passes the required state and methods to the component.

The container component also renders the AddressBar component that shows the user's account number on the screen.

You can view the code for the container component at the GitHub repository, at this link: https://github.com/PacktPublishing/Blockchain-Development-for-Finance-Projects/blob/master/Chapter%204/CorpRemApp/src/Components/Container.js.

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

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