Skip to content

💡 A project that demonstrates the possibility of managing data in your React project that talks to external REST API through Context API and custom Hooks, increasing your code quality and maintainability.

License

Notifications You must be signed in to change notification settings

ajeetchaulagain/react-clean-code-pattern

Repository files navigation

Maintainability

react-clean-code-pattern

I have created this project to demonstrate how a data/state in react components can be managed in a clean, maintainable way using the React Context API combined with custom hooks.

Instructions on Running Project

This project uses Next.js as a React framework as it is simple to use and comes with a lot of features. To simulate the REST server for API calls, json-server is used.

Running a Project

  1. Clone this repo and cd to project root directory
  2. Install required npm packages - npm i
  3. Run the Next.js dev server - npm run dev
  4. Run the json-server - npm run json-server

This will lunch your next.js application at port 3000 and json-server at port 4000 in your local machine. Browse http://localhost:3000 to view the application.

Note: The dummy data required to simulate REST server through json-server is extracted from https://randomuser.me/ and stored at /data/db.json

Resources

Contribution

If you find any issues or improvement regarding the code please consider submitting the pull request.

License

This project is open source and available under MIT License

About

💡 A project that demonstrates the possibility of managing data in your React project that talks to external REST API through Context API and custom Hooks, increasing your code quality and maintainability.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published