Skip to content

Commit 80e7357

Browse files
committed
Added Readme
1 parent f71a3fe commit 80e7357

File tree

3 files changed

+38
-65
lines changed

3 files changed

+38
-65
lines changed

README.md

Lines changed: 27 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,40 @@
1-
# Getting Started with Create React App
1+
<h1 align="center">
2+
<br>
3+
Practice React-Js useContext Hook, ContextAPI and Spread-operator.
4+
<br>
5+
</h1>
26

3-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
7+
<h4 align="center">This is a simple Practice Guide of React-Js useContext Hook, ContextAPI and Spread-operator on a simple e-commerce Application. How the "Add to cart" actually work using these hooks and concepts.</h4>
48

5-
## Available Scripts
9+
<h5 align="center">Don't forget to give a ⭐️ </h5>
10+
<hr>
611

7-
In the project directory, you can run:
12+
![screenshot](public/preview.gif)
13+
<hr>
814

9-
### `npm start`
1015

11-
Runs the app in the development mode.\
12-
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
16+
## How To Use
1317

14-
The page will reload when you make changes.\
15-
You may also see any lint errors in the console.
18+
To clone and run this application, you'll need [Git](https://git-scm.com) and [Node.js](https://nodejs.org/en/download/) (which comes with [npm](http://npmjs.com)) installed on your computer. From your command line:
1619

17-
### `npm test`
20+
```bash
21+
# Clone this repository
22+
$ git clone https://github.com/hafizmp/Context-API-useContext-Guide.git
1823

19-
Launches the test runner in the interactive watch mode.\
20-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
24+
# Go into the repository
25+
$ cd Context-API-useContext-Guide
2126

22-
### `npm run build`
27+
# Install dependencies
28+
$ npm install
2329

24-
Builds the app for production to the `build` folder.\
25-
It correctly bundles React in production mode and optimizes the build for the best performance.
30+
# Run the app
31+
$ npm start
32+
```
2633

27-
The build is minified and the filenames include the hashes.\
28-
Your app is ready to be deployed!
34+
> **Note**
35+
> If you're using Linux Bash for Windows, [see this guide](https://www.howtogeek.com/261575/how-to-run-graphical-linux-desktop-applications-from-windows-10s-bash-shell/) or use `node` from the command prompt.
2936
30-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
37+
## Links
3138

32-
### `npm run eject`
33-
34-
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
35-
36-
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37-
38-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39-
40-
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41-
42-
## Learn More
43-
44-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45-
46-
To learn React, check out the [React documentation](https://reactjs.org/).
47-
48-
### Code Splitting
49-
50-
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51-
52-
### Analyzing the Bundle Size
53-
54-
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55-
56-
### Making a Progressive Web App
57-
58-
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59-
60-
### Advanced Configuration
61-
62-
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63-
64-
### Deployment
65-
66-
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67-
68-
### `npm run build` fails to minify
69-
70-
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
39+
- Solution URL: [GitHub](https://github.com/hafizmp/Context-API-useContext-Guide)
40+
- Live Site URL: [CodeSandBox](https://codesandbox.io/s/context-api-fd6w25)

public/preview.gif

8.81 MB
Loading

src/components/Checkout.jsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@ export const Checkout = () => {
66
const { items } = useContext(CartContext);
77

88
return (
9-
<div className='checkout__container'>
9+
<div className="checkout__container">
1010
<h2>Checkout</h2>
11-
<div className="checkout__items">
11+
<div className="product__container">
1212
{items.map((item, index) => (
13-
<div key={index}>
14-
<img src={item.thumb} alt="" />
15-
<h2>{item.name}</h2>
16-
<h3>{item.price}</h3>
13+
<div key={index} className="cards__area">
14+
<div className="cards__img">
15+
<img src={item.thumb} alt={item.name} />
16+
</div>
17+
<div className="cards__details">
18+
<h3>{item.name}</h3>
19+
<p>${item.price}</p>
20+
</div>
1721
</div>
18-
))
19-
}
22+
))}
2023
</div>
2124
</div>
2225
)

0 commit comments

Comments
 (0)