Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the post.

Please choose the appropriate section so your post can be easily searched.

Please choose suitable Keywords Ex: post, video.

Browse

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 4822

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Latest Questions

Author
  • 61k
Author
Asked: November 27, 20242024-11-27T03:34:07+00:00 2024-11-27T03:34:07+00:00

build a Simple Todo with ReactJs Angular VueJs

  • 61k

Introduction

todoApps are a classic project for learning new frameworks and building one with Reactjs & Angular & Vue can provide valuable insights into the strengths and differences of each. in this Post we will walk through the process of creating a basic todo app with each of these popular frameworks and we'll delve into the differences between these popular frameworks and explore their strengths and use cases.

Note
Before you start make sure u have Nodejs and npm installed

1. Creating the Project:

React :

npx create-react-app todo-react cd todo-react  
Enter fullscreen mode Exit fullscreen mode

Angular :

npm install -g @angular/cli ng new todo-angular cd todo-angular  
Enter fullscreen mode Exit fullscreen mode

Vue :

npm install -g @vue/cli vue create todo-vue cd todo-vue  
Enter fullscreen mode Exit fullscreen mode

2. Implementing the Todo List:

React :

import React, { useState } from 'react'; function App() {   const [todos, setTodos] = useState([]);   const [inputValue, setInputValue] = useState('');    const addTodo = () => {     setTodos([...todos, inputValue]);     setInputValue('');   };    const removeTodo = (index) => {     const newTodos = [...todos];     newTodos.splice(index, 1);     setTodos(newTodos);   };   return (     <div>       <input         type="text"         value={inputValue}         onChange={(e) => setInputValue(e.target.value)}       />       <button onClick={addTodo}>Add</button>       <ul>         {todos.map((todo, index) => (           <li key={index}>             {todo} <button onClick={() => removeTodo(index)}>Remove</button>           </li>         ))}       </ul>     </div>   ); } export default App;  
Enter fullscreen mode Exit fullscreen mode

Angular :

import { Component } from '@angular/core';  @Component({   selector: 'app-root',   templateUrl: './app.component.html',   styleUrls: ['./app.component.css'] }) export class AppComponent {   todos: string[] = [];   inputValue: string = '';    addTodo() {     this.todos.push(this.inputValue);     this.inputValue = '';   }    removeTodo(index: number) {     this.todos.splice(index, 1);   } }  
Enter fullscreen mode Exit fullscreen mode

<input type="text" [(ngModel)]="inputValue"> <button (click)="addTodo()">Add</button> <ul>   <li *ngFor="let todo of todos; let i = index">     {{ todo }} <button (click)="removeTodo(i)">Remove</button>   </li> </ul>  
Enter fullscreen mode Exit fullscreen mode

Vue :

<template>   <div>     <input type="text" v-model="inputValue">     <button @click="addTodo">Add</button>     <ul>       <li v-for="(todo, index) in todos" :key="index">         {{ todo }} <button @click="removeTodo(index)">Remove</button>       </li>     </ul>   </div> </template>  <script> export default {   data() {     return {       todos: [],       inputValue: ''     };   },   methods: {     addTodo() {       this.todos.push(this.inputValue);       this.inputValue = '';     },     removeTodo(index) {       this.todos.splice(index, 1);     }   } } </script>  
Enter fullscreen mode Exit fullscreen mode

3. Running the App :

React :

npm start  
Enter fullscreen mode Exit fullscreen mode

Angular :

npm start || ng serve  
Enter fullscreen mode Exit fullscreen mode

Vue :

npm run serve  
Enter fullscreen mode Exit fullscreen mode

congratulations you have successfully built a simple todo app using React & Angular & Vue

angularreactvuewebdev
  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 0
  • Best Answers 0
  • Users 2k
  • Popular
  • Answers
  • Author

    Insights into Forms in Flask

    • 0 Answers
  • Author

    Kick Start Your Next Project With Holo Theme

    • 0 Answers
  • Author

    Refactoring for Efficiency: Tackling Performance Issues in Data-Heavy Pages

    • 0 Answers

Top Members

Samantha Carter

Samantha Carter

  • 0 Questions
  • 20 Points
Begginer
Ella Lewis

Ella Lewis

  • 0 Questions
  • 20 Points
Begginer
Isaac Anderson

Isaac Anderson

  • 0 Questions
  • 20 Points
Begginer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore, ask, and connect. Join our vibrant Q&A community today!

About Us

  • About Us
  • Contact Us
  • All Users

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 Querify Question. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.