The Project Management App is a simple and efficient React-based task and project management tool. It allows users to create projects, add tasks, and manage them effectively. The app is built with React 19, utilizes state management with hooks, and employs Tailwind CSS for styling.
useState
- Simple yet effective state handling.
project-management-app/
āāā src/
ā āāā components/ # Reusable UI components
ā ā āāā Button.js # Reusable button component
ā ā āāā Input.js # Input field component (supports text and textarea)
ā ā āāā Modal.js # Reusable modal component
ā ā āāā NewProject.js # Form for adding new projects
ā ā āāā NewTask.js # Input field for adding tasks
ā ā āāā NoProjectSelected.js # UI when no project is selected
ā ā āāā ProjectsSideBar.js # Sidebar for selecting projects
ā ā āāā SelectedProject.js # Displays project details and tasks
ā ā āāā Tasks.js # Task management component
ā āāā App.js # Main application component
ā āāā index.js # Entry point of the app
āāā public/ # Static assets (icons, images)
āāā package.json # Project dependencies and scripts
āāā tailwind.config.js # Tailwind CSS configuration
āāā vite.config.js # Vite configuration for faster builds
āāā .gitignore # Files to ignore in Git
āāā README.md # Project documentation
git clone https://github.com/Caiko/project-management-app.git
cd project-management-app
npm install
npm run dev
Then open localhost:5173 (default for Vite) in your browser.
useState()
const [projectsState, setProjectsState] = useState({
selectedProjectId: undefined,
projects: [],
tasks: [],
});
function handleAddProject(projectData) {
setProjectsState((prevState) => {
const projectId = Math.random();
const newProject = { ...projectData, id: projectId };
return {
...prevState,
selectedProjectId: undefined,
projects: [...prevState.projects, newProject],
};
});
}
function handleAddTask(text) {
setProjectsState((prevState) => {
const taskId = Math.random();
const newTask = { text, projectId: prevState.selectedProjectId, id: taskId };
return { ...prevState, tasks: [newTask, ...prevState.tasks] };
});
}
<Modal ref={modal} buttonCaptionProp="Okay">
<h2 className="text-xl font-bold text-stone-700 mt-4 my-4">Invalid Input</h2>
<p className="text-stone-600 mb-4">Oops... Please fill all fields!</p>
</Modal>
useImperativeHandle
for external control of the modal.