This project was based on the YouTube video Intermediate React.js Coding Interview (ft. Clément Mihailescu) by Ben Awad and Clément Mihailescu
The Challenge:
- Fetch the data from https://randomuser.me/api/
- Generate a table based on the users' address details
- Enable sorting based on columns
- Add an field which will enable filtering based on values on rows
- Install the dependencies using npm install
- Run the application using npm run start
npm install
npm run start
- Use fetchto get data from the api reference; called once on mount of the page/application
- Deconstruct the data and format it the way I wanted to show in my table
- Create a mapping of the key and name and save it as the headerobject array
- Create a separate component for the table headers (column) and table data (rows)
- Add an input field for filtering text
- Create a pure function tableFilterTextto filter all the users based onfilterTextwhich is updated on change of the input field
- Add a handleSortonClick function to column headers
- Create a pure function tableSortByColumnto sort based onsortObjectwhich is updated onhandleSort