truffle-box / react-box

Truffle, Webpack and React boilerplate.
https://truffle-box.github.io/
MIT License
736 stars 251 forks source link

Class to Functional Component React Hooks ( useState, useEffect ) #117

Closed yasir991925 closed 4 years ago

yasir991925 commented 4 years ago

Class based component App is updated with functional based component using useState and useEffect This truffle box is a starter kit and might be more playful with React Hooks, in places like form creation ( can have multiple states inside a component ) and updating UI states. The componentDidMount has been updated to "init" and the useEffect hook covers its functionality. Async and await was not working inside the useEffect so the init aka ComponentDidMount re-structured with Promise .then.catch.

There is also a minor change in the getWeb3.js file ( next change proposal ) << removed the window.addEventListener('load'. await()=>{} ......