This project was bootstrapped with Create React App.
create-react-app
React Hooks
useState
, useEffect
axios
(All the Components are in the 'components' Folder)
Folder Structure
-src
-Components
-Navbar
-Jumbotron
-Cards__Container
-Page
Page is the Main Stateful Component which Renders The other 3 Dumb Functional Components
All Components are Hooks Based
Naming Convention Used - BEM
For Styling the Components - CSS
State Variables -
- Array - which Hold the informaation of the Cards
- Index of the clicked Card - Intially of the First Element
It Fetches the Data From the API
Populates the Array with that Data
Renders that Array using map
Whenever User Clicks a Card, Click Handler is triggered and the Index of the Card in the State is Updated
And Object at that Index is Passed to The Jumbotron (The Big Card)
And the card with that index is Filtered by adding a different Css class so that it appears clicked and has a 'Purple' Backgorund
In the project directory, you can run:
-
You need to have the following installed (Latest Version Preferred)
- Node.js
- npm
- create-react-app using npm
-
Run 'npm install'
- To Install all the dependencies
-
Run 'npm start'
- To Run the Project In Dev Mode
-
Run 'ctrl + C' in the Command Line to stop the Node Deamon from serving the react app
- Update Node and npm to latest version
- Try installing Cors library using npm as this Project uses External API to Fetch Data
- Comment Down the Error, and we will try to solve it