Initial Commit Performing Crud Operations #1
Loading…
Reference in a new issue
No description provided.
Delete branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ -0,0 +6,4 @@
import './styles.css'; // Importing the CSS file
const App = () => {
const [users, setUsers] = useState([]);
States and Data management need to be done inside the routes.
@ -0,0 +25,4 @@
{/* User List Route */}
<Route
path="/"
element={<UserList users={users} setUsers={setUsers} />}
Don't pass the params here where you defining the routes. It effects the component reusability
@ -0,0 +10,4 @@
const handleDelete = () => {
console.log("Users before deletion:", users);
console.log("ID to delete:", userId);
remove console statements
@ -0,0 +15,4 @@
setUser(foundUser);
} else {
const fetchUsers = async () => {
const response = await fetch("https://jsonplaceholder.typicode.com/users");
use fetch single user by id