Skip to content

Instantly share code, notes, and snippets.

View Prabhukiran161's full-sized avatar
πŸ’­
Code. Debug. Repeat. πŸ”„πŸ’»

Prabhu Kiran Prabhukiran161

πŸ’­
Code. Debug. Repeat. πŸ”„πŸ’»
View GitHub Profile
@Prabhukiran161
Prabhukiran161 / UsersData.jsx
Created October 4, 2025 10:12
Fetching User Data - Build a component that fetches and displays user data from a public API (e.g., JSONPlaceholder). When the component mounts, it should fetch the data and display it. The component should also handle loading and error states.
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"
@Prabhukiran161
Prabhukiran161 / CounterApp.jsx
Created October 3, 2025 16:22
[Counter Application] Create a simple counter application that increments and decrements a number when buttons are clicked. The counter value should persist in local storage, so that when the page is refreshed, the counter value remains the same.
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(()=>{
@Prabhukiran161
Prabhukiran161 / TaskItems.jsx
Created October 3, 2025 14:00
To do App [ React Practice]
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",