Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Next.js Tutorial
  • Next.js Components
  • Next.js Functions
  • Next.js Deployment
  • Next.js Projects
  • Next.js Routing
  • Next.js Styles
  • Next.js Server-Side Rendering
  • Next.js Environment Variables
  • Next.js Middleware
  • Next.js Typescript
  • Next.js Image Optimization
  • Next.js Data Fetching
Open In App
Next Article:
Build a Task Management App using Next JS
Next article icon

Building a Task Reminder App with Next.js

Last Updated : 28 Mar, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

In this article, we’ll walk through the step-by-step process of creating a basic task reminder app with Next.JS. This application will provide users with a user-friendly interface for adding the title of the task, its description, and its due date & time. The user will also be notified through a pop-up 1 minute before the task scheduled time.

Output Preview: Let us have a look at how the final output will look like.

Screenshot-2024-03-27-104055

Prerequisites:

  • Next.js
  • CSS
  • NodeJS

Approach to Create Task Reminder App with Next.js:

  • Set up a new Nextjs project with create-next-app. Initialize a Git repository. Define the project structure.
  • Within the “text-reminder-app” folder, create the following files and directories:
    • Create a pages/index.js file for the homepage where users can add tasks.
    • Create a components/Task.js file for displaying individual tasks.
    • Create a components/TaskList.js file for displaying the list of tasks.
    • Create a styles/Home.module.css file, it contains the CSS styles for the components.
  • Inside the “text-reminder-app” folder, run the command npm install react react-dom next to install the project dependencies.

Steps to Create Task Reminder App with Next.js:

Step 1: Create a directory for the project.

mkdir text-reminder-app
cd text-reminder-app

Step 2: Initialized the Nextjs app and installing the required packages

npx create-next-app .

Step 3: Install the necessary package for your project using the following command.

npm install react react-dom next

Project Structure:

Screenshot-2024-03-27-103408

The dependencies in package.json file will look like:

"dependencies": {
"react": "^18",
"react-dom": "^18",
"next": "14.1.3"
}

Example: Create the required files and write the following code.

CSS
/* Home.module.css */  .container {   max-width: 600px;   margin: 0 auto;   padding: 20px; }  .header {   display: flex;   align-items: center;   margin-bottom: 20px; }  .logo {   width: 50px;   height: 50px;   margin-right: 10px; }  .title {   font-size: 24px;   display: flex;   /* justify-content: center; */   align-items: center;  }  .input {   width: calc(100% - 20px);   margin-bottom: 10px;   padding: 10px;   font-size: 16px;   border: 1px solid #ccc;   border-radius: 5px; }  .button {   padding: 10px 20px;   font-size: 16px;   background-color: #007bff;   color: #fff;   border: none;   border-radius: 5px;   cursor: pointer; }  .task {   margin-bottom: 10px;   padding: 10px;   border: 1px solid #ccc;   border-radius: 5px; }  .task-title {   font-size: 18px;   margin-bottom: 5px; }  .task-description {   font-size: 14px;   color: #555; }  .task-due {   font-size: 14px;   color: #777; } 
JavaScript
// index.js  import React, { useState, useEffect } from 'react'; import TaskList from '../components/TaskList'; import styles from '../styles/Home.module.css';  export default function Home() {   const [tasks, setTasks] = useState([]);   const [title, setTitle] = useState('');   const [description, setDescription] = useState('');   const [dueDate, setDueDate] = useState('');   const [dueTime, setDueTime] = useState('');   const [completedTasks, setCompletedTasks] = useState(new Set());    const addTask = () => {     if (!title || !description || !dueDate || !dueTime) return;      const dueDateTime = new Date(`${dueDate}T${dueTime}:00`);      setTasks([...tasks, { id: tasks.length, title, description, dueDateTime }]);     setTitle('');     setDescription('');     setDueDate('');     setDueTime('');   };    useEffect(() => {     const reminders = tasks.map(task => {       const timeDiff = task.dueDateTime - Date.now();       if (timeDiff > 0 && !completedTasks.has(task.id)) {         return setTimeout(() => {           alert(`Reminder: ${task.title} is due in 1 minute.`);           setCompletedTasks(prevCompletedTasks => new Set(prevCompletedTasks).add(task.id));         }, timeDiff - 60000);       }       return null;     });      return () => {       reminders.forEach(reminder => {         if (reminder) clearTimeout(reminder);       });     };   }, [tasks, completedTasks]);    const removeTask = (index) => {     const newTasks = tasks.filter(task => task.id !== index);     setTasks(newTasks);   };    return (     <div className={styles.container}>       <span className={styles.header}>         <img src="https://media.geeksforgeeks.org/wp-content/uploads/20240320180346/gfg(1).png" alt="GeeksforGeeks logo" className={styles.logo} />         <h1 className={styles.title}>Task Reminder App</h1>       </span>       <input type="text" className={styles.input} placeholder="Title" value={title} onChange={(e) => setTitle(e.target.value)} />       <input type="text" className={styles.input} placeholder="Description" value={description} onChange={(e) => setDescription(e.target.value)} />       <input type="date" className={styles.input} value={dueDate} onChange={(e) => setDueDate(e.target.value)} />       <input type="time" className={styles.input} value={dueTime} onChange={(e) => setDueTime(e.target.value)} />       <button onClick={addTask} className={styles.button}>Add Task</button>       <TaskList tasks={tasks.sort((a, b) => a.dueDateTime - b.dueDateTime)} removeTask={removeTask} />     </div>   ); } 
JavaScript
// Task.js  import React from 'react'; import styles from '../styles/Home.module.css';  const Task = ({ task }) => {   const { title, description, dueDateTime } = task;    return (     <div className={styles.task}>       <h2 className={styles.taskTitle}>{title}</h2>       <p className={styles.taskDescription}>{description}</p>       <p className={styles.taskDue}>Due Date: {dueDateTime.toLocaleString()}</p>     </div>   ); };  export default Task; 
JavaScript
// TaskList.js  import React from 'react'; import Task from './Task';  const TaskList = ({ tasks }) => {   return (     <div>       <h2>Tasks</h2>       {tasks.map((task, index) => (         <Task key={index} task={task} />       ))}     </div>   ); };  export default TaskList; 

Start your application using the following command.

npm run dev

Output:

Task-Remainder-NextJS
Final Output Preview

Next Article
Build a Task Management App using Next JS
author
mohammedraziullahansari
Improve
Article Tags :
  • Project
  • Web Technologies
  • ReactJS
  • Dev Scripter
  • Next.js
  • Web Development Projects
  • Dev Scripter 2024
  • Next.js - Projects

Similar Reads

  • Build a Notes App with Next.js
    Note-taking App is a simple web application that allows users to create, edit, and delete text notes. The app provides a user-friendly interface for managing notes, making it easy to add new notes, update existing notes, and delete notes when they are no longer needed. The app provides a way for use
    4 min read
  • How to Build a REST API with Next.js 13?
    Next.js is the most widely used React framework. Next.js 13.2 introduced a new file-based routing mechanism, called App Router, for building React frontend and serverless backend. In this article, we will be building a simple REST API using Next.js Route Handlers Table of Content Next.js Route Handl
    7 min read
  • Build a Task Management App using Next JS
    A Task management app is a useful web application that assists in efficiently organizing and managing tasks. It provides various functionalities such as creating tasks, assigning prioritie­s and deadlines, marking complete tasks, and enabling task search based on ke­ywords and priorities. Preview of
    5 min read
  • Build a Photo Sharing App Using Next.js
    We will build a photo-sharing app using Next.js. This app will allow users to upload and share photos with a community. We will use Bootstrap for styling and localStorage to store the photos. The application will consist of two main pages: a home page to display the uploaded photos and an upload pag
    4 min read
  • Daily Activity Planner App with Next.js
    Managing your tasks is one of the most important things in a hectic routine. In this article, we will see step-by-step procedure of creating a task manager app from scratch. Output Preview: Let us have a look at how the final output will look like. Prerequisites :Introduction to Next.jsReact HooksNP
    6 min read
  • Build a Job Board with Next.js
    In this article, we will guide you through creating a dynamic job board application using Next.js. A job board application helps job seekers browse, filter, and apply for job openings while enabling employers to post job listings. Project Preview Prerequisites:ReactJSNext.jsNodeJSBootstrapApproach t
    7 min read
  • Task Scheduling App with Node and Express.js
    Task Scheduling app is an app that can be used to create, update, delete, and view all the tasks created. It is implemented using NodeJS and ExpressJS. The scheduler allows users to add tasks in the cache of the current session, once the app is reloaded the data gets deleted. This can be scaled usin
    4 min read
  • Build a Movie APP Using Next.js
    We will create a movie database app using Next.js and an external movie API (such as The Movie Database API). The app will enable users to view movies, search for specific movies, and view detailed information about each movie, including the title, release date, rating, brief description, and a list
    7 min read
  • Build a Recipe Manager Using Next.js
    A Recipe Manager is a web application that allows users to manage and share their recipes. This application enables users to add new recipes, view a list of recipes, manage recipe and search for recipes by title. Built with Next.js, this app leverages server-side rendering for better performance. Us
    10 min read
  • Build a Car Rental System Using Next.js
    We will build a car rental system using Next.js, a popular React framework that provides server-side rendering and static site generation. This platform will allow users to browse and book vehicles for short-term usage. Output Preview: Let us have a look at how the final output will look like. Prere
    9 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences