/xhr

Primary LanguageJavaScript

XHR Demo

This is a simple React application that allows users to view a list of posts fetched from an API and add new posts using XHR.

Setup

  1. Clone the repository:

    git clone https://github.com/monurajputrko/xhr.git
  2. Navigate to the project directory:

    cd react-post-app
  3. Install dependencies:

    npm install

Usage

  1. Run the development server:

    npm start
  2. 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.

Functionality

  • 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.

#Demo https://xhr-pi.vercel.app/

Dependencies

  • React
  • ReactDOM

License

This project is licensed under the MIT License - see the LICENSE file for details.