This Project allows you to practice the concepts and techniques learned last Sunday and apply them in a concrete project. This assignment explored React advanced state management with Redux Toolkit. In your Project for this assignment, you will demonstrate proficiency by creating a Single Page Application that performs CRUD (Create, Read, Update, Delete) operations on a locally hosted API server.
Read these instructions carefully. Understand exactly what is expected before starting this assignment.
Follow these steps to set up and work on your project:
- Create a forked copy of this project.
- Clone your OWN version of Repo (Not Gabi's by mistake!).
- Create a new Branch on the clone: git checkout -b
<firstName-lastName>
. - Implement the project on this Branch, committing changes regularly.
- Push commits: git push origin
<firstName-lastName>
. - RUN
npm install
at the root to retrieve all the dependencies for the node server. You will not need to create any react apps here nor will you need to install any other dependencies. You should have all you need in this repo. - RUN
npm run dev
at the root of your project.
------------------- SERVER ----------------------
- LOOK at all the files you've been given for this project. One important folder to note is
server
. This folder contains an API that you are going to be interfacing with. Below is documentation on how to interact with the API. - CHANGE
cd
intoserver
folder! - RUN
npm install
in theserver
folder. - RUN
npm start
to get your API up and running onhttp://localhost:9000
. This is the URL you're going to need to use within your React app in order to make AJAX requests for data. - After your API is up and running, you can open chrome and type in
http://localhost:9000/notes
. You should see an Array[]
. This is an array that your API will be using to store your notes data. - Keep your server running while working on your project.
Follow these steps for completing your project:
- Submit a Pull-Request to merge Branch into master (student's Repo).
- Submit your assignment at the student portal.
Remove all props from components and use useSelector
and useDispatch
to get data from Redux store.
-
Create a directory called
store
under src, addindex.js
-
Create another directory under store called
api
and addNoteSlice.js
, implement your reducer/actions logic here. -
In
Notes
component to display all the notes fromuseSelector
-
Change all props in
AddNote
component and useuseDispatch
to make call toNoteSlice
. -
Do the same for
EditNote
. -
Make sure to redirect the user after editing or adding a note using
useNavigation
hook. -
Make sure to implement the logic to delete notes.
-
Example:
[
{
title: 'Clean the house',
content: "Buy cleaning products to clean"
}
];
- ADVANCED Use RTK Query instead of Redux Toolkit!