This is a simple React application that allows users to view a list of posts fetched from an API and add new posts.
-
Clone the repository:
git clone https://github.com/Premjeet-yadav/xhr
-
Navigate to the project directory:
cd react-post-app
-
Install dependencies:
npm install
-
Run the development server:
npm start
-
Open the application in your browser:
The development server should start running at
http://localhost:3000
. Open this URL in your web browser to view the application.
-
The application consists of two main components:
PostList
: Displays a list of posts fetched from the API.NewPostForm
: Allows users to add a new post by filling out a form.
-
Posts are fetched from the JSONPlaceholder API (
https://jsonplaceholder.typicode.com/posts
). -
New posts are added using a POST request to the same API endpoint.
react-post-app/
│
├── src/
│ ├── App.js
│ ├── App.css
│ ├── index.js
│ └── ...
│
├── public/
│ ├── index.html
│ └── ...
│
├── README.md
└── package.json
- React
- ReactDOM
This project is licensed under the MIT License - see the LICENSE file for details.