UniversityDAO / udao

The official UniversityDAO DApp repository.
GNU Lesser General Public License v2.1
4 stars 4 forks source link

Redux Integration With React #63

Closed austin-davis1 closed 2 years ago

austin-davis1 commented 2 years ago

This PR addresses #49.

Redux is a global state management system that allows us to have a global store that can be accessed on each page without having to pass down props to every component. Upon App render, we grab all the data from IPFS and the blockchain. Then, this data is pushed to our global store. Any time we need this data on any page, we can use react-redux hooks (useSelector) to grab data from the global store. This significantly cleans up our data flow, as Redux seems to be the industry standard for React apps.

Upon refresh, App will re-render entirely and pull all the data once again, fixing the refresh issue. If a user refreshes on a particular page, let's say the proposals page, they will be no re-directing to any loading pages. They will land back on the proposals page, and while new data is loading in (since app still has to re-pull data) I have added a loading icon where our cards would normally be. As soon as data finishes loading, the cards will reappear.