This is a simple Counter App built with React.js
- Demo
- Features
- Technologies Used
- Getting Started
- Available Scripts
- How It Works
- Future Improvements
- Challenges and Learnings
You can view a live demo of the project here.
- Utilizes Context API for global state management
- Increment the counter value
- Decrement the counter value
- Reset the counter to 0
- Responsive and clean UI
- React (for building the UI)
- Vite (for fast development environment)
- JavaScript/JSX (for logic and structure)
- Context API (for state management)
- CSS (for styling)
Follow these instructions to run the project locally:
Ensure you have Node.js and npm installed. If not, you can download them from here.
-
Clone the repository:
git clone https://github.com/Jiteshiyu/Tallytide.git cd Tallytide
-
Install the dependencies:
npm install
-
Start the development server:
npm run dev
-
Open your browser and navigate to
http://localhost:3000
to see the app.
npm run dev
: Start the development server.npm run build
: Build the app for production.npm run preview
: Preview the production build locally.
This app uses Context API to manage the state of the counter. The CounterContext
provides the counter value (count
) and functions (increment
, decrement
, reset
) to update it.
- Context API is used to avoid prop drilling, making state available globally to all components within the app.
- The Counter component renders the
Count
andControls
components, with the current counter value and button controls, respectively. - State Management: The state is centralized in the
CounterState
component, which wraps around theCount
andControls
components, allowing them to access the counter state and update functions viauseContext
.
- Add local storage support: Save the counter state between page reloads using local storage.
- Add undo/redo functionality: Allow users to revert the last action (increment/decrement) or reapply it.
- Multiple Counters: Extend the app to handle multiple counters with independent states.
- Accessibility Enhancements: Improve the app's accessibility to meet WCAG guidelines (e.g., keyboard navigation and screen reader support).
- State Management with Context API: Implementing Context API for the first time was a valuable learning experience. It helped eliminate prop drilling, which simplified component communication.
- React Component Structure: Structuring the app with clear separation between logic (
Controls
) and display (Count
) components made the code more modular and reusable. - Styling Consistency: Managing consistent and responsive styling across components was important for a cohesive UI. Tailwind CSS or Styled Components could be explored in future versions to streamline this.
Give a 🌟 to this repo if you liked it .
Connect with me