This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from "react"; | |
const UsersData= ()=>{ | |
const [users,setUsers]=useState([]); | |
const [loading,setLoading]=useState(true); | |
const [error, setError]=useState(null); | |
const fetchUsers = async () => { | |
try { | |
const response = await fetch( | |
"https://jsonplaceholder.typicode.com/users" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from "react"; | |
const CounterApp =() => { | |
const [count,setCount] = useState(()=>{ | |
const savedCount = localStorage.getItem("count"); | |
return savedCount ? parseInt(savedCount,10) : 0; | |
}); | |
const buttonStyle={fontSize:"1.5rem", marginRight:"20px", padding:"0.5rem", color:"black", borderRadius:"8px"}; | |
const headingStyle={fontSize:"3rem"}; | |
useEffect(()=>{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from "react"; | |
export const TaskItems = ({ currentTask, updateTasks, deleteTasks, handleToggle}) => { | |
const [isEditing, setIsEditing]=useState(false); | |
const [newTitle,setNewTitle]=useState(currentTask.title); | |
const [newPriority,setNewPriority]=useState(currentTask.priority); | |
const taskStyle = { | |
marginBottom: 20, | |
display: "flex", | |
justifyContent: "center", |