Implement a simple Movie Night Planner application using React Hooks. This app allows users to add movies to a watchlist and randomly select a movie for movie night.
- Reading and understanding the assignment: 2 minutes
- Implementing MovieNightPlanner component (src/MovieNightPlanner.js): 15 minutes
- Running tests and debugging (src/MovieNightPlanner.test.js): 10 minutes
- Final review and submission: 3 minutes
By completing this assignment, you will:
- Implement and use React Hooks (useState, useEffect)
- Create a functional React component
- Manage state and side effects in a React application
- Implement local storage for data persistence
React Hooks are fundamental to modern React development. This assignment provides hands-on experience with:
- Managing component state in functional components
- Handling side effects
- Implementing basic CRUD operations
- Working with browser local storage
These skills are essential for developing efficient, maintainable React applications in professional settings.
react-hooks-movie-night-planner/
├── public/
│ ├── favicon.ico
│ ├── index.html
│ ├── manifest.json
│ └── robots.txt
├── src/
│ ├── MovieNightPlanner.js # Main component
│ ├── MovieNightPlanner.test.js # Test file for the component
│ ├── index.js # Entry point
│ └── setupTests.js # Test setup file
├── package.json # Project dependencies and scripts
├── package-lock.json # Locked versions of dependencies
└── README.md # This file
-
Clone your assignment repository:
git clone <your-repo-url>
-
Navigate to the project directory:
cd <file folder>
-
Install the project dependencies:
npm install
-
Install additional development dependency:
npm install --save-dev @babel/plugin-proposal-private-property-in-object
-
In
src/MovieNightPlanner.js
:- Import necessary hooks from React
- Implement the MovieNightPlanner component
- Use useState to manage the list of movies, input field, and selected movie
- Use useEffect to handle localStorage operations
- Implement addMovie and pickMovie functions
- Render the component with necessary UI elements
-
In
src/MovieNightPlanner.test.js
:- Implement tests for rendering, adding movies, picking a movie, and localStorage persistence
Run the tests using:
npm test
- Ensure all your changes are in the
src
directory files. - Commit and push your changes:
git add . git commit -m "Complete React Hooks Movie Night Planner assignment" git push origin main
- Verify that all tests pass in GitHub Actions.
- Submit the URL of your GitHub repository in Canvas.
- Submit a screenshot of the passing terminal unittest.
- Verify comments have been added explaining your work, just as you would do in a real-world scenario. Cite usage of outside tools or help from others.
Grades are on a scale of 0-10, with 10 representing truly exceptional work that goes above and beyond expectations.
- Correct implementation of MovieNightPlanner component (55%)
- Proper use of React Hooks (useState, useEffect) (20%)
- Passing all provided tests in both remote terminal and GitHub classrooms (20%)
- Exceptional effort and creativity (5%)
Grade descriptions:
- 10: Outstanding work that demonstrates mastery of the subject matter and includes innovative approaches or extra features beyond the basic requirements.
- 8-9: Excellent work that fully meets all requirements with high quality implementation.
- 6-7: Good work that meets most requirements with some minor issues.
- 4-5: Adequate work that meets basic requirements but has notable room for improvement.
- 2-3: Work that partially meets requirements but has significant issues or missing elements.
- 0-1: Work that fails to meet most requirements or is incomplete.
Note: A score of 10 is reserved for truly exceptional submissions that showcase a deep understanding of React concepts and go above and beyond in terms of code quality, creativity, or additional features.