week4.2 React foundation

befor making fullstack application


install these modules

  1. npm create vite@latest
  2. npm init/ npm install
  3. npm install express
  4. npm install mongoose
  5. npm install zod
  6. npm install cors


// todo list app using simple html and js

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
        <script>
            let globalId = 1;
            function marAsDone(todoId) {
                const parent = document.getElementById(todoId);
                parent.children[2].innerHTML = "Done!";
            }
            function createChild(title, description, id) {
                const child = document.createElement("div");
                const firstGrandParent = document.createElement("div");
                firstGrandParent.innerHTML = title;
                const secondGrandParent = document.createElement("div");
                secondGrandParent.innerHTML = description;
                const thirdGrandParent = document.createElement("div");
                thirdGrandParent.innerHTML = "Mark as Done";
                thirdGrandParent.setAttribute("onclick", `markAsDone(${id})`);
                child.appendChild(firstGrandParent);
                child.appendChild(secondGrandParent);
                child.appendChild(thirdGrandParent);
                child.setAttribute("id", id);
                return child;
            }
            function addTodo() {
                const title = document.getElementById("title").value;
                const description = document.getElementById("description").value;
                //document.createElement
                const parent = document.getElementById("todoId");
                
                parent.appendChild(createChild(title, description, globalId++));
            }
        </script>
</body>
</html>


  1. npm create vite@latest // to create the frame of react and project name always use this code
  2. npm install // before running your code
  3. npm run dev // write this command to run your code



Comments

Popular posts from this blog

CyberSecurity

VERTICAL SCALING 💋

prisma using in project idx 13.3