├── react-hooks
├── src
│ ├── App.css
│ ├── index.css
│ ├── main.jsx
│ ├── App.jsx
│ └── assets
│ │ └── react.svg
├── vite.config.js
├── .gitignore
├── index.html
├── package.json
├── README.md
├── eslint.config.js
└── public
│ └── vite.svg
├── README.md
├── redux-tool
├── src
│ ├── App.css
│ ├── index.css
│ ├── App
│ │ └── store.js
│ ├── App.jsx
│ ├── main.jsx
│ ├── features
│ │ └── todo
│ │ │ └── todoSlice.js
│ ├── components
│ │ ├── AddTodo.jsx
│ │ └── Todos.jsx
│ └── assets
│ │ └── react.svg
├── vite.config.js
├── .gitignore
├── index.html
├── package.json
├── README.md
├── eslint.config.js
└── public
│ └── vite.svg
├── context_API-2
├── src
│ ├── App.css
│ ├── index.css
│ ├── main.jsx
│ ├── context
│ │ └── Theme.js
│ ├── App.jsx
│ ├── component
│ │ ├── ThemeBtn.jsx
│ │ └── Card.jsx
│ └── assets
│ │ └── react.svg
├── tailwind.config.js
├── vite.config.js
├── .gitignore
├── index.html
├── package.json
├── README.md
├── eslint.config.js
└── public
│ └── vite.svg
├── context_API_LS
├── src
│ ├── App.css
│ ├── index.css
│ ├── context
│ │ ├── index.js
│ │ └── TodoContext.js
│ ├── main.jsx
│ ├── components
│ │ ├── TodoForm.jsx
│ │ └── TodoItem.jsx
│ ├── App.jsx
│ └── assets
│ │ └── react.svg
├── vite.config.js
├── .gitignore
├── index.html
├── package.json
├── README.md
├── eslint.config.js
└── public
│ └── vite.svg
├── custom-hooks
├── src
│ ├── App.css
│ ├── index.css
│ ├── components
│ │ ├── index.js
│ │ └── Input.jsx
│ ├── main.jsx
│ ├── hooks
│ │ └── useCurrencyInfo.js
│ ├── App.jsx
│ └── assets
│ │ └── react.svg
├── vite.config.js
├── .gitignore
├── index.html
├── package.json
├── README.md
├── eslint.config.js
├── public
│ └── vite.svg
└── currency.md
├── react-bg-btn
├── src
│ ├── App.css
│ ├── index.css
│ ├── main.jsx
│ ├── components
│ │ └── card.jsx
│ ├── App.jsx
│ └── assets
│ │ └── react.svg
├── vite.config.js
├── .gitignore
├── index.html
├── package.json
├── README.md
├── eslint.config.js
└── public
│ └── vite.svg
├── react-router
├── src
│ ├── index.css
│ ├── components
│ │ ├── User
│ │ │ └── User.jsx
│ │ ├── GitHub
│ │ │ └── Github.jsx
│ │ ├── About
│ │ │ └── About.jsx
│ │ ├── Home
│ │ │ └── Home.jsx
│ │ ├── Header
│ │ │ └── Header.jsx
│ │ ├── Contact
│ │ │ └── Contact.jsx
│ │ └── Footer
│ │ │ └── Footer.jsx
│ ├── App.jsx
│ ├── App.css
│ ├── main.jsx
│ └── assets
│ │ └── react.svg
├── vite.config.js
├── .gitignore
├── index.html
├── package.json
├── README.md
├── eslint.config.js
└── public
│ └── vite.svg
├── image.png
└── context_API
├── src
├── context
│ ├── UserContext.js
│ └── UserContextProvider.jsx
├── main.jsx
├── components
│ ├── Profile.jsx
│ └── Login.jsx
├── App.jsx
├── App.css
├── index.css
└── assets
│ └── react.svg
├── vite.config.js
├── .gitignore
├── index.html
├── package.json
├── README.md
├── eslint.config.js
└── public
└── vite.svg
/react-hooks/src/App.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | my react learnings 😀
2 |
--------------------------------------------------------------------------------
/redux-tool/src/App.css:
--------------------------------------------------------------------------------
1 | @import 'tailwindcss'
--------------------------------------------------------------------------------
/context_API-2/src/App.css:
--------------------------------------------------------------------------------
1 | @import 'tailwindcss'
--------------------------------------------------------------------------------
/context_API-2/src/index.css:
--------------------------------------------------------------------------------
1 | @import 'tailwindcss'
--------------------------------------------------------------------------------
/context_API_LS/src/App.css:
--------------------------------------------------------------------------------
1 | @import 'tailwindcss'
--------------------------------------------------------------------------------
/custom-hooks/src/App.css:
--------------------------------------------------------------------------------
1 | @import 'tailwindcss'
--------------------------------------------------------------------------------
/custom-hooks/src/index.css:
--------------------------------------------------------------------------------
1 | @import 'tailwindcss'
--------------------------------------------------------------------------------
/react-bg-btn/src/App.css:
--------------------------------------------------------------------------------
1 | @import 'tailwindcss'
--------------------------------------------------------------------------------
/react-hooks/src/index.css:
--------------------------------------------------------------------------------
1 | @import 'tailwindcss'
--------------------------------------------------------------------------------
/redux-tool/src/index.css:
--------------------------------------------------------------------------------
1 | @import 'tailwindcss'
--------------------------------------------------------------------------------
/context_API_LS/src/index.css:
--------------------------------------------------------------------------------
1 | @import 'tailwindcss'
--------------------------------------------------------------------------------
/react-router/src/index.css:
--------------------------------------------------------------------------------
1 | @import 'tailwindcss';
2 |
--------------------------------------------------------------------------------
/react-bg-btn/src/index.css:
--------------------------------------------------------------------------------
1 | @import "tailwindcss";
2 |
--------------------------------------------------------------------------------
/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manoj-jm/React-project/HEAD/image.png
--------------------------------------------------------------------------------
/context_API_LS/src/context/index.js:
--------------------------------------------------------------------------------
1 | export {useTodo,TodoContext,TodoProvider} from './TodoContext'
--------------------------------------------------------------------------------
/custom-hooks/src/components/index.js:
--------------------------------------------------------------------------------
1 | import Input from "./input";
2 |
3 |
4 |
5 | export {Input}
--------------------------------------------------------------------------------
/context_API/src/context/UserContext.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | const UserContext = React.createContext()
4 |
5 | export default UserContext
--------------------------------------------------------------------------------
/context_API/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import react from '@vitejs/plugin-react'
3 |
4 | // https://vite.dev/config/
5 | export default defineConfig({
6 | plugins: [react()],
7 | })
8 |
--------------------------------------------------------------------------------
/redux-tool/src/App/store.js:
--------------------------------------------------------------------------------
1 | import { configureStore } from "@reduxjs/toolkit";
2 | import todoReducer from '../features/todo/todoSlice';
3 |
4 | export const store = configureStore({
5 | reducer : todoReducer
6 | })
--------------------------------------------------------------------------------
/context_API-2/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss'.Config)} */
2 |
3 | export default {
4 | content: ["./index.html", "./src/**/*.{js,ts}"],
5 | darkMode: "class",
6 | theme: {
7 | extend: {},
8 | },
9 | Plugin: [],
10 | };
11 |
--------------------------------------------------------------------------------
/react-hooks/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import react from '@vitejs/plugin-react'
3 | import tailwindcss from '@tailwindcss/vite'
4 | // https://vite.dev/config/
5 | export default defineConfig({
6 | plugins: [react(),tailwindcss()],
7 | })
8 |
--------------------------------------------------------------------------------
/custom-hooks/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import react from '@vitejs/plugin-react'
3 | import tailwindcss from '@tailwindcss/vite'
4 |
5 | // https://vite.dev/config/
6 | export default defineConfig({
7 | plugins: [react(),tailwindcss()],
8 | })
9 |
--------------------------------------------------------------------------------
/react-bg-btn/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import react from "@vitejs/plugin-react";
3 | import tailwindcss from "@tailwindcss/vite";
4 | // https://vite.dev/config/
5 | export default defineConfig({
6 | plugins: [react(), tailwindcss()],
7 | });
8 |
--------------------------------------------------------------------------------
/react-router/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import react from "@vitejs/plugin-react";
3 | import tailwindcss from "@tailwindcss/vite";
4 | // https://vite.dev/config/
5 | export default defineConfig({
6 | plugins: [react(), tailwindcss()],
7 | });
8 |
--------------------------------------------------------------------------------
/redux-tool/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'vite'
2 | import react from '@vitejs/plugin-react'
3 | import tailwindcss from '@tailwindcss/vite'
4 |
5 | // https://vite.dev/config/
6 | export default defineConfig({
7 | plugins: [react(),tailwindcss()],
8 | })
9 |
--------------------------------------------------------------------------------
/context_API_LS/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import react from "@vitejs/plugin-react";
3 | import tailwindcss from "@tailwindcss/vite";
4 | // https://vite.dev/config/
5 | export default defineConfig({
6 | plugins: [react(), tailwindcss()],
7 | });
8 |
--------------------------------------------------------------------------------
/react-bg-btn/src/main.jsx:
--------------------------------------------------------------------------------
1 | import { StrictMode } from 'react'
2 | import { createRoot } from 'react-dom/client'
3 | import './index.css'
4 | import App from './App.jsx'
5 |
6 | createRoot(document.getElementById('root')).render(
7 |
8 |
9 |
10 | )
11 |
--------------------------------------------------------------------------------
/context_API-2/vite.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import react from "@vitejs/plugin-react";
3 | import tailwindcss from "@tailwindcss/vite";
4 |
5 | // https://vite.dev/config/
6 | export default defineConfig({
7 | plugins: [react(), tailwindcss()],
8 | });
9 |
--------------------------------------------------------------------------------
/context_API-2/src/main.jsx:
--------------------------------------------------------------------------------
1 | import { StrictMode } from 'react'
2 | import { createRoot } from 'react-dom/client'
3 | import './index.css'
4 | import App from './App.jsx'
5 |
6 | createRoot(document.getElementById('root')).render(
7 |
8 |
9 | ,
10 | )
11 |
--------------------------------------------------------------------------------
/context_API/src/main.jsx:
--------------------------------------------------------------------------------
1 | import { StrictMode } from 'react'
2 | import { createRoot } from 'react-dom/client'
3 | import './index.css'
4 | import App from './App.jsx'
5 |
6 | createRoot(document.getElementById('root')).render(
7 |
8 |
9 | ,
10 | )
11 |
--------------------------------------------------------------------------------
/context_API_LS/src/main.jsx:
--------------------------------------------------------------------------------
1 | import { StrictMode } from 'react'
2 | import { createRoot } from 'react-dom/client'
3 | import './index.css'
4 | import App from './App.jsx'
5 |
6 | createRoot(document.getElementById('root')).render(
7 |
8 |
9 | ,
10 | )
11 |
--------------------------------------------------------------------------------
/custom-hooks/src/main.jsx:
--------------------------------------------------------------------------------
1 | import { StrictMode } from 'react'
2 | import { createRoot } from 'react-dom/client'
3 | import './index.css'
4 | import App from './App.jsx'
5 |
6 | createRoot(document.getElementById('root')).render(
7 |
8 |
9 | ,
10 | )
11 |
--------------------------------------------------------------------------------
/react-hooks/src/main.jsx:
--------------------------------------------------------------------------------
1 | import { StrictMode } from 'react'
2 | import { createRoot } from 'react-dom/client'
3 | import './index.css'
4 | import App from './App.jsx'
5 |
6 | createRoot(document.getElementById('root')).render(
7 |
8 |
9 | ,
10 | )
11 |
--------------------------------------------------------------------------------
/redux-tool/src/App.jsx:
--------------------------------------------------------------------------------
1 | import './App.css'
2 | import AddTodo from './components/AddTodo'
3 | import Todos from './components/Todos'
4 |
5 | function App() {
6 |
7 | return (
8 | <>
9 |
10 |
11 | >
12 | )
13 | }
14 |
15 | export default App
16 |
--------------------------------------------------------------------------------
/react-router/src/components/User/User.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { useParams } from 'react-router-dom'
3 |
4 | function User() {
5 | const {userid} = useParams()
6 | return (
7 |
User: {userid}
8 | )
9 | }
10 |
11 | export default User
--------------------------------------------------------------------------------
/context_API/src/components/Profile.jsx:
--------------------------------------------------------------------------------
1 | import React, { useContext } from "react";
2 | import UserContext from "../context/userContext";
3 |
4 | const Profile = () => {
5 | const { user } = useContext(UserContext);
6 | if (!user) return Please Login
;
7 | return Welcome {user.username}
;
8 | };
9 |
10 | export default Profile;
11 |
--------------------------------------------------------------------------------
/context_API-2/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/context_API/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/custom-hooks/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/react-bg-btn/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/react-hooks/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/react-router/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/redux-tool/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/context_API_LS/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/redux-tool/src/main.jsx:
--------------------------------------------------------------------------------
1 | import { StrictMode } from 'react'
2 | import { createRoot } from 'react-dom/client'
3 | import './index.css'
4 | import App from './App.jsx'
5 | import { Provider } from 'react-redux'
6 | import { store } from './App/store.js'
7 |
8 | createRoot(document.getElementById('root')).render(
9 |
10 |
11 | ,
12 | )
13 |
--------------------------------------------------------------------------------
/context_API/src/App.jsx:
--------------------------------------------------------------------------------
1 | import { useState } from 'react'
2 | import Login from './components/Login'
3 | import './App.css'
4 | import UserContextProvider from './context/userContextProvider'
5 | import Profile from './components/Profile'
6 |
7 | function App() {
8 | return (
9 |
10 |
11 |
12 |
13 | )
14 | }
15 |
16 | export default App
17 |
--------------------------------------------------------------------------------
/redux-tool/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Vite + React
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/context_API-2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Vite + React
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/context_API/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Vite + React
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/context_API_LS/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Vite + React
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/custom-hooks/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Vite + React
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/react-bg-btn/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Vite + React
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/react-router/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Vite + React
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/context_API/src/context/UserContextProvider.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import UserContext from "./userContext";
3 |
4 |
5 | const UserContextProvider = ({ children }) => {
6 | const [user, setUser] = React.useState(null); // api call is done here
7 | return (
8 |
9 | {children}
10 |
11 | );
12 | };
13 |
14 | export default UserContextProvider;
15 |
--------------------------------------------------------------------------------
/react-router/src/App.jsx:
--------------------------------------------------------------------------------
1 |
2 | import Header from "./components/Header/Header"
3 | import './App.css'
4 | import { Outlet } from 'react-router-dom'
5 | import Footer from './components/Footer/Footer'
6 | function App() {
7 |
8 |
9 | return (
10 | <>
11 | {/* React Router */}
12 |
13 |
14 |
15 | >
16 | )
17 | }
18 |
19 | export default App
20 |
--------------------------------------------------------------------------------
/context_API-2/src/context/Theme.js:
--------------------------------------------------------------------------------
1 | import { createContext, useContext } from "react";
2 |
3 | export const ThemeContext = createContext({
4 | themeMode: "light",
5 | lightTheme: () => {},
6 | darkTheme: () => {},
7 | });
8 |
9 | export const ThemeContextProvider = ThemeContext.Provider;
10 |
11 | // custom hook
12 | export default function useTheme() {
13 | // u don't need to import useContext and ThemeContext , just this useTheme
14 | return useContext(ThemeContext);
15 | }
16 |
--------------------------------------------------------------------------------
/context_API_LS/src/context/TodoContext.js:
--------------------------------------------------------------------------------
1 | import { useContext, createContext } from "react";
2 |
3 | export const TodoContext = createContext({
4 | todos: [{ id: 1, todo: "message", completed: false }],
5 | addTodo: (todo) => {},
6 | updateTodo: (id, todo) => {},
7 | deleteTodo: (id) => {},
8 | toggleTodo: (id) => {},
9 | });
10 |
11 | export const TodoContextProvider = TodoContext.Provider;
12 |
13 | export function useTodo() {
14 | return useContext(TodoContext);
15 | }
16 |
--------------------------------------------------------------------------------
/react-hooks/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Vite + React
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/custom-hooks/src/hooks/useCurrencyInfo.js:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from "react";
2 |
3 | function useCurrencyInfo(currency) {
4 | const [data, setData] = useState({});
5 |
6 | useEffect(() => {
7 | fetch(
8 | `https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/${currency}.json`
9 | )
10 | .then((res) => res.json())
11 | .then((data) => setData(data[currency] || {}))
12 | .catch((error) => console.error("Error fetching currency data:", error));
13 | }, [currency]);
14 |
15 | return data;
16 | }
17 |
18 | export default useCurrencyInfo;
19 |
--------------------------------------------------------------------------------
/redux-tool/src/features/todo/todoSlice.js:
--------------------------------------------------------------------------------
1 | import { createSlice, nanoid } from "@reduxjs/toolkit";
2 |
3 |
4 | const initialState = {
5 |
6 | todos:[{id:1,text:"hello"}]
7 | }
8 |
9 |
10 | export const todoSlice = createSlice({
11 | name:"todo",
12 | initialState,
13 | reducers:{
14 | addTodo : (state,action)=>{
15 | const todo = {id:nanoid(),text:action.payload}
16 | state.todos.push(todo);
17 |
18 | },
19 | removeTodo : (state,action)=>{
20 | state.todos = state.todos.filter((todo)=> todo.id !== action.payload)
21 | }
22 | }
23 | })
24 |
25 |
26 | export const { addTodo , removeTodo} = todoSlice.actions;
27 | export default todoSlice.reducer
--------------------------------------------------------------------------------
/context_API/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "context-api",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "lint": "eslint .",
10 | "preview": "vite preview"
11 | },
12 | "dependencies": {
13 | "react": "^19.0.0",
14 | "react-dom": "^19.0.0"
15 | },
16 | "devDependencies": {
17 | "@eslint/js": "^9.21.0",
18 | "@types/react": "^19.0.10",
19 | "@types/react-dom": "^19.0.4",
20 | "@vitejs/plugin-react": "^4.3.4",
21 | "eslint": "^9.21.0",
22 | "eslint-plugin-react-hooks": "^5.1.0",
23 | "eslint-plugin-react-refresh": "^0.4.19",
24 | "globals": "^15.15.0",
25 | "vite": "^6.2.0"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/context_API/src/App.css:
--------------------------------------------------------------------------------
1 | #root {
2 | max-width: 1280px;
3 | margin: 0 auto;
4 | padding: 2rem;
5 | text-align: center;
6 | }
7 |
8 | .logo {
9 | height: 6em;
10 | padding: 1.5em;
11 | will-change: filter;
12 | transition: filter 300ms;
13 | }
14 | .logo:hover {
15 | filter: drop-shadow(0 0 2em #646cffaa);
16 | }
17 | .logo.react:hover {
18 | filter: drop-shadow(0 0 2em #61dafbaa);
19 | }
20 |
21 | @keyframes logo-spin {
22 | from {
23 | transform: rotate(0deg);
24 | }
25 | to {
26 | transform: rotate(360deg);
27 | }
28 | }
29 |
30 | @media (prefers-reduced-motion: no-preference) {
31 | a:nth-of-type(2) .logo {
32 | animation: logo-spin infinite 20s linear;
33 | }
34 | }
35 |
36 | .card {
37 | padding: 2em;
38 | }
39 |
40 | .read-the-docs {
41 | color: #888;
42 | }
43 |
--------------------------------------------------------------------------------
/react-bg-btn/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-chai",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "lint": "eslint .",
10 | "preview": "vite preview"
11 | },
12 | "dependencies": {
13 | "@tailwindcss/vite": "^4.1.1",
14 | "react": "^19.0.0",
15 | "react-dom": "^19.0.0",
16 | "tailwindcss": "^4.1.1"
17 | },
18 | "devDependencies": {
19 | "@eslint/js": "^9.21.0",
20 | "@types/react": "^19.0.10",
21 | "@types/react-dom": "^19.0.4",
22 | "@vitejs/plugin-react": "^4.3.4",
23 | "eslint": "^9.21.0",
24 | "eslint-plugin-react-hooks": "^5.1.0",
25 | "eslint-plugin-react-refresh": "^0.4.19",
26 | "globals": "^15.15.0",
27 | "vite": "^6.2.0"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/react-hooks/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-hooks",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "lint": "eslint .",
10 | "preview": "vite preview"
11 | },
12 | "dependencies": {
13 | "@tailwindcss/vite": "^4.1.1",
14 | "react": "^19.0.0",
15 | "react-dom": "^19.0.0",
16 | "tailwindcss": "^4.1.1"
17 | },
18 | "devDependencies": {
19 | "@eslint/js": "^9.21.0",
20 | "@types/react": "^19.0.10",
21 | "@types/react-dom": "^19.0.4",
22 | "@vitejs/plugin-react": "^4.3.4",
23 | "eslint": "^9.21.0",
24 | "eslint-plugin-react-hooks": "^5.1.0",
25 | "eslint-plugin-react-refresh": "^0.4.19",
26 | "globals": "^15.15.0",
27 | "vite": "^6.2.0"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/react-router/src/App.css:
--------------------------------------------------------------------------------
1 | #root {
2 | max-width: 1280px;
3 | margin: 0 auto;
4 | padding: 2rem;
5 | text-align: center;
6 | }
7 |
8 | .logo {
9 | height: 6em;
10 | padding: 1.5em;
11 | will-change: filter;
12 | transition: filter 300ms;
13 | }
14 | .logo:hover {
15 | filter: drop-shadow(0 0 2em #646cffaa);
16 | }
17 | .logo.react:hover {
18 | filter: drop-shadow(0 0 2em #61dafbaa);
19 | }
20 |
21 | @keyframes logo-spin {
22 | from {
23 | transform: rotate(0deg);
24 | }
25 | to {
26 | transform: rotate(360deg);
27 | }
28 | }
29 |
30 | @media (prefers-reduced-motion: no-preference) {
31 | a:nth-of-type(2) .logo {
32 | animation: logo-spin infinite 20s linear;
33 | }
34 | }
35 |
36 | .card {
37 | padding: 2em;
38 | }
39 |
40 | .read-the-docs {
41 | color: #888;
42 | }
43 |
--------------------------------------------------------------------------------
/context_API-2/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "context-api-2",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "lint": "eslint .",
10 | "preview": "vite preview"
11 | },
12 | "dependencies": {
13 | "@tailwindcss/vite": "^4.1.4",
14 | "react": "^19.0.0",
15 | "react-dom": "^19.0.0",
16 | "tailwindcss": "^4.1.4"
17 | },
18 | "devDependencies": {
19 | "@eslint/js": "^9.21.0",
20 | "@types/react": "^19.0.10",
21 | "@types/react-dom": "^19.0.4",
22 | "@vitejs/plugin-react": "^4.3.4",
23 | "eslint": "^9.21.0",
24 | "eslint-plugin-react-hooks": "^5.1.0",
25 | "eslint-plugin-react-refresh": "^0.4.19",
26 | "globals": "^15.15.0",
27 | "vite": "^6.2.0"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/custom-hooks/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "custom-hooks",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "lint": "eslint .",
10 | "preview": "vite preview"
11 | },
12 | "dependencies": {
13 | "@tailwindcss/vite": "^4.1.1",
14 | "react": "^19.0.0",
15 | "react-dom": "^19.0.0",
16 | "tailwindcss": "^4.1.1"
17 | },
18 | "devDependencies": {
19 | "@eslint/js": "^9.21.0",
20 | "@types/react": "^19.0.10",
21 | "@types/react-dom": "^19.0.4",
22 | "@vitejs/plugin-react": "^4.3.4",
23 | "eslint": "^9.21.0",
24 | "eslint-plugin-react-hooks": "^5.1.0",
25 | "eslint-plugin-react-refresh": "^0.4.19",
26 | "globals": "^15.15.0",
27 | "vite": "^6.2.0"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/context_API_LS/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "context-api-ls",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "lint": "eslint .",
10 | "preview": "vite preview"
11 | },
12 | "dependencies": {
13 | "@tailwindcss/vite": "^4.1.4",
14 | "react": "^19.0.0",
15 | "react-dom": "^19.0.0",
16 | "tailwindcss": "^4.1.4"
17 | },
18 | "devDependencies": {
19 | "@eslint/js": "^9.21.0",
20 | "@types/react": "^19.0.10",
21 | "@types/react-dom": "^19.0.4",
22 | "@vitejs/plugin-react": "^4.3.4",
23 | "eslint": "^9.21.0",
24 | "eslint-plugin-react-hooks": "^5.1.0",
25 | "eslint-plugin-react-refresh": "^0.4.19",
26 | "globals": "^15.15.0",
27 | "vite": "^6.2.0"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/react-router/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-router",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "lint": "eslint .",
10 | "preview": "vite preview"
11 | },
12 | "dependencies": {
13 | "@tailwindcss/vite": "^4.1.3",
14 | "react": "^19.0.0",
15 | "react-dom": "^19.0.0",
16 | "react-router-dom": "^7.5.0",
17 | "tailwindcss": "^4.1.3"
18 | },
19 | "devDependencies": {
20 | "@eslint/js": "^9.21.0",
21 | "@types/react": "^19.0.10",
22 | "@types/react-dom": "^19.0.4",
23 | "@vitejs/plugin-react": "^4.3.4",
24 | "eslint": "^9.21.0",
25 | "eslint-plugin-react-hooks": "^5.1.0",
26 | "eslint-plugin-react-refresh": "^0.4.19",
27 | "globals": "^15.15.0",
28 | "vite": "^6.2.0"
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/context_API-2/README.md:
--------------------------------------------------------------------------------
1 | # React + Vite
2 |
3 | This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4 |
5 | Currently, two official plugins are available:
6 |
7 | - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8 | - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9 |
10 | ## Expanding the ESLint configuration
11 |
12 | If you are developing a production application, we recommend using TypeScript and enable type-aware lint rules. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
13 |
--------------------------------------------------------------------------------
/context_API/README.md:
--------------------------------------------------------------------------------
1 | # React + Vite
2 |
3 | This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4 |
5 | Currently, two official plugins are available:
6 |
7 | - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8 | - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9 |
10 | ## Expanding the ESLint configuration
11 |
12 | If you are developing a production application, we recommend using TypeScript and enable type-aware lint rules. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
13 |
--------------------------------------------------------------------------------
/custom-hooks/README.md:
--------------------------------------------------------------------------------
1 | # React + Vite
2 |
3 | This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4 |
5 | Currently, two official plugins are available:
6 |
7 | - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8 | - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9 |
10 | ## Expanding the ESLint configuration
11 |
12 | If you are developing a production application, we recommend using TypeScript and enable type-aware lint rules. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
13 |
--------------------------------------------------------------------------------
/react-bg-btn/README.md:
--------------------------------------------------------------------------------
1 | # React + Vite
2 |
3 | This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4 |
5 | Currently, two official plugins are available:
6 |
7 | - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8 | - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9 |
10 | ## Expanding the ESLint configuration
11 |
12 | If you are developing a production application, we recommend using TypeScript and enable type-aware lint rules. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
13 |
--------------------------------------------------------------------------------
/react-hooks/README.md:
--------------------------------------------------------------------------------
1 | # React + Vite
2 |
3 | This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4 |
5 | Currently, two official plugins are available:
6 |
7 | - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8 | - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9 |
10 | ## Expanding the ESLint configuration
11 |
12 | If you are developing a production application, we recommend using TypeScript and enable type-aware lint rules. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
13 |
--------------------------------------------------------------------------------
/react-router/README.md:
--------------------------------------------------------------------------------
1 | # React + Vite
2 |
3 | This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4 |
5 | Currently, two official plugins are available:
6 |
7 | - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8 | - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9 |
10 | ## Expanding the ESLint configuration
11 |
12 | If you are developing a production application, we recommend using TypeScript and enable type-aware lint rules. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
13 |
--------------------------------------------------------------------------------
/context_API_LS/README.md:
--------------------------------------------------------------------------------
1 | # React + Vite
2 |
3 | This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4 |
5 | Currently, two official plugins are available:
6 |
7 | - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8 | - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9 |
10 | ## Expanding the ESLint configuration
11 |
12 | If you are developing a production application, we recommend using TypeScript and enable type-aware lint rules. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
13 |
--------------------------------------------------------------------------------
/redux-tool/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "redux-tool",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "lint": "eslint .",
10 | "preview": "vite preview"
11 | },
12 | "dependencies": {
13 | "@reduxjs/toolkit": "^2.7.0",
14 | "@tailwindcss/vite": "^4.1.4",
15 | "react": "^19.0.0",
16 | "react-dom": "^19.0.0",
17 | "react-redux": "^9.2.0",
18 | "tailwindcss": "^4.1.4"
19 | },
20 | "devDependencies": {
21 | "@eslint/js": "^9.22.0",
22 | "@types/react": "^19.0.10",
23 | "@types/react-dom": "^19.0.4",
24 | "@vitejs/plugin-react": "^4.3.4",
25 | "eslint": "^9.22.0",
26 | "eslint-plugin-react-hooks": "^5.2.0",
27 | "eslint-plugin-react-refresh": "^0.4.19",
28 | "globals": "^16.0.0",
29 | "vite": "^6.3.1"
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/redux-tool/README.md:
--------------------------------------------------------------------------------
1 | # React + Vite
2 |
3 | This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4 |
5 | Currently, two official plugins are available:
6 |
7 | - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
8 | - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9 |
10 | ## Expanding the ESLint configuration
11 |
12 | If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
13 |
--------------------------------------------------------------------------------
/react-router/src/components/GitHub/Github.jsx:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from 'react'
2 | import { useLoaderData } from 'react-router-dom'
3 |
4 | function Github() {
5 | const data = useLoaderData()
6 | // const [data, setData] = useState([])
7 | // useEffect(() => {
8 | // fetch('https://api.github.com/users/manoj-jm')
9 | // .then(response => response.json())
10 | // .then(data => {
11 | // console.log(data);
12 | // setData(data)
13 | // })
14 | // }, [])
15 |
16 | return (
17 | Github followers: 1
18 |
19 |
Name : {data.name}
20 |
21 | )
22 | }
23 |
24 | export default Github
25 |
26 | export const githubInfoLoader = async () => {
27 | const response = await fetch('https://api.github.com/users/manoj-jm')
28 | return response.json()
29 | }
--------------------------------------------------------------------------------
/context_API/eslint.config.js:
--------------------------------------------------------------------------------
1 | import js from '@eslint/js'
2 | import globals from 'globals'
3 | import reactHooks from 'eslint-plugin-react-hooks'
4 | import reactRefresh from 'eslint-plugin-react-refresh'
5 |
6 | export default [
7 | { ignores: ['dist'] },
8 | {
9 | files: ['**/*.{js,jsx}'],
10 | languageOptions: {
11 | ecmaVersion: 2020,
12 | globals: globals.browser,
13 | parserOptions: {
14 | ecmaVersion: 'latest',
15 | ecmaFeatures: { jsx: true },
16 | sourceType: 'module',
17 | },
18 | },
19 | plugins: {
20 | 'react-hooks': reactHooks,
21 | 'react-refresh': reactRefresh,
22 | },
23 | rules: {
24 | ...js.configs.recommended.rules,
25 | ...reactHooks.configs.recommended.rules,
26 | 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
27 | 'react-refresh/only-export-components': [
28 | 'warn',
29 | { allowConstantExport: true },
30 | ],
31 | },
32 | },
33 | ]
34 |
--------------------------------------------------------------------------------
/react-hooks/eslint.config.js:
--------------------------------------------------------------------------------
1 | import js from '@eslint/js'
2 | import globals from 'globals'
3 | import reactHooks from 'eslint-plugin-react-hooks'
4 | import reactRefresh from 'eslint-plugin-react-refresh'
5 |
6 | export default [
7 | { ignores: ['dist'] },
8 | {
9 | files: ['**/*.{js,jsx}'],
10 | languageOptions: {
11 | ecmaVersion: 2020,
12 | globals: globals.browser,
13 | parserOptions: {
14 | ecmaVersion: 'latest',
15 | ecmaFeatures: { jsx: true },
16 | sourceType: 'module',
17 | },
18 | },
19 | plugins: {
20 | 'react-hooks': reactHooks,
21 | 'react-refresh': reactRefresh,
22 | },
23 | rules: {
24 | ...js.configs.recommended.rules,
25 | ...reactHooks.configs.recommended.rules,
26 | 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
27 | 'react-refresh/only-export-components': [
28 | 'warn',
29 | { allowConstantExport: true },
30 | ],
31 | },
32 | },
33 | ]
34 |
--------------------------------------------------------------------------------
/redux-tool/eslint.config.js:
--------------------------------------------------------------------------------
1 | import js from '@eslint/js'
2 | import globals from 'globals'
3 | import reactHooks from 'eslint-plugin-react-hooks'
4 | import reactRefresh from 'eslint-plugin-react-refresh'
5 |
6 | export default [
7 | { ignores: ['dist'] },
8 | {
9 | files: ['**/*.{js,jsx}'],
10 | languageOptions: {
11 | ecmaVersion: 2020,
12 | globals: globals.browser,
13 | parserOptions: {
14 | ecmaVersion: 'latest',
15 | ecmaFeatures: { jsx: true },
16 | sourceType: 'module',
17 | },
18 | },
19 | plugins: {
20 | 'react-hooks': reactHooks,
21 | 'react-refresh': reactRefresh,
22 | },
23 | rules: {
24 | ...js.configs.recommended.rules,
25 | ...reactHooks.configs.recommended.rules,
26 | 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
27 | 'react-refresh/only-export-components': [
28 | 'warn',
29 | { allowConstantExport: true },
30 | ],
31 | },
32 | },
33 | ]
34 |
--------------------------------------------------------------------------------
/context_API_LS/eslint.config.js:
--------------------------------------------------------------------------------
1 | import js from '@eslint/js'
2 | import globals from 'globals'
3 | import reactHooks from 'eslint-plugin-react-hooks'
4 | import reactRefresh from 'eslint-plugin-react-refresh'
5 |
6 | export default [
7 | { ignores: ['dist'] },
8 | {
9 | files: ['**/*.{js,jsx}'],
10 | languageOptions: {
11 | ecmaVersion: 2020,
12 | globals: globals.browser,
13 | parserOptions: {
14 | ecmaVersion: 'latest',
15 | ecmaFeatures: { jsx: true },
16 | sourceType: 'module',
17 | },
18 | },
19 | plugins: {
20 | 'react-hooks': reactHooks,
21 | 'react-refresh': reactRefresh,
22 | },
23 | rules: {
24 | ...js.configs.recommended.rules,
25 | ...reactHooks.configs.recommended.rules,
26 | 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
27 | 'react-refresh/only-export-components': [
28 | 'warn',
29 | { allowConstantExport: true },
30 | ],
31 | },
32 | },
33 | ]
34 |
--------------------------------------------------------------------------------
/context_API_LS/src/components/TodoForm.jsx:
--------------------------------------------------------------------------------
1 | import React, { useState } from "react";
2 | import { useTodo } from "../context/TodoContext";
3 |
4 |
5 | function TodoForm() {
6 | const [todo, setTodo] = useState("");
7 | const { addTodo } = useTodo();
8 |
9 | const appendTodo = (e) => {
10 | e.preventDefault();
11 | addTodo({todo,completed:false});
12 | setTodo('')
13 | };
14 | return (
15 |
31 | );
32 | }
33 |
34 | export default TodoForm;
35 |
--------------------------------------------------------------------------------
/custom-hooks/eslint.config.js:
--------------------------------------------------------------------------------
1 | import js from '@eslint/js'
2 | import globals from 'globals'
3 | import reactHooks from 'eslint-plugin-react-hooks'
4 | import reactRefresh from 'eslint-plugin-react-refresh'
5 |
6 | export default [
7 | { ignores: ['dist'] },
8 | {
9 | files: ['**/*.{js,jsx}'],
10 | languageOptions: {
11 | ecmaVersion: 2020,
12 | globals: globals.browser,
13 | parserOptions: {
14 | ecmaVersion: 'latest',
15 | ecmaFeatures: { jsx: true },
16 | sourceType: 'module',
17 | },
18 | },
19 | plugins: {
20 | 'react-hooks': reactHooks,
21 | 'react-refresh': reactRefresh,
22 | },
23 | rules: {
24 | ...js.configs.recommended.rules,
25 | ...reactHooks.configs.recommended.rules,
26 | 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
27 | 'react-refresh/only-export-components': [
28 | 'warn',
29 | { allowConstantExport: true },
30 | ],
31 | },
32 | },
33 | ]
34 |
--------------------------------------------------------------------------------
/react-bg-btn/eslint.config.js:
--------------------------------------------------------------------------------
1 | import js from '@eslint/js'
2 | import globals from 'globals'
3 | import reactHooks from 'eslint-plugin-react-hooks'
4 | import reactRefresh from 'eslint-plugin-react-refresh'
5 |
6 | export default [
7 | { ignores: ['dist'] },
8 | {
9 | files: ['**/*.{js,jsx}'],
10 | languageOptions: {
11 | ecmaVersion: 2020,
12 | globals: globals.browser,
13 | parserOptions: {
14 | ecmaVersion: 'latest',
15 | ecmaFeatures: { jsx: true },
16 | sourceType: 'module',
17 | },
18 | },
19 | plugins: {
20 | 'react-hooks': reactHooks,
21 | 'react-refresh': reactRefresh,
22 | },
23 | rules: {
24 | ...js.configs.recommended.rules,
25 | ...reactHooks.configs.recommended.rules,
26 | 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
27 | 'react-refresh/only-export-components': [
28 | 'warn',
29 | { allowConstantExport: true },
30 | ],
31 | },
32 | },
33 | ]
34 |
--------------------------------------------------------------------------------
/react-router/eslint.config.js:
--------------------------------------------------------------------------------
1 | import js from '@eslint/js'
2 | import globals from 'globals'
3 | import reactHooks from 'eslint-plugin-react-hooks'
4 | import reactRefresh from 'eslint-plugin-react-refresh'
5 |
6 | export default [
7 | { ignores: ['dist'] },
8 | {
9 | files: ['**/*.{js,jsx}'],
10 | languageOptions: {
11 | ecmaVersion: 2020,
12 | globals: globals.browser,
13 | parserOptions: {
14 | ecmaVersion: 'latest',
15 | ecmaFeatures: { jsx: true },
16 | sourceType: 'module',
17 | },
18 | },
19 | plugins: {
20 | 'react-hooks': reactHooks,
21 | 'react-refresh': reactRefresh,
22 | },
23 | rules: {
24 | ...js.configs.recommended.rules,
25 | ...reactHooks.configs.recommended.rules,
26 | 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
27 | 'react-refresh/only-export-components': [
28 | 'warn',
29 | { allowConstantExport: true },
30 | ],
31 | },
32 | },
33 | ]
34 |
--------------------------------------------------------------------------------
/context_API-2/eslint.config.js:
--------------------------------------------------------------------------------
1 | import js from '@eslint/js'
2 | import globals from 'globals'
3 | import reactHooks from 'eslint-plugin-react-hooks'
4 | import reactRefresh from 'eslint-plugin-react-refresh'
5 |
6 | export default [
7 | { ignores: ['dist'] },
8 |
9 | {
10 | files: ['**/*.{js,jsx}'],
11 | languageOptions: {
12 | ecmaVersion: 2020,
13 | globals: globals.browser,
14 | parserOptions: {
15 | ecmaVersion: 'latest',
16 | ecmaFeatures: { jsx: true },
17 | sourceType: 'module',
18 | },
19 | },
20 | plugins: {
21 | 'react-hooks': reactHooks,
22 | 'react-refresh': reactRefresh,
23 | },
24 | rules: {
25 | ...js.configs.recommended.rules,
26 | ...reactHooks.configs.recommended.rules,
27 | 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
28 | 'react-refresh/only-export-components': [
29 | 'warn',
30 | { allowConstantExport: true },
31 | ],
32 | },
33 | },
34 | ]
35 |
--------------------------------------------------------------------------------
/context_API/src/components/Login.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { useState, useContext } from "react";
3 | import userContext from "../context/userContext";
4 |
5 | const Login = () => {
6 | const [username, setUsername] = useState(null);
7 | const [password, setPassword] = useState(null);
8 |
9 | const {setUser} = useContext(userContext);
10 |
11 | const handleSubmit = (e) => {
12 | e.preventDefault()
13 | setUser({username,password })
14 | };
15 | return (
16 |
17 |
Login
18 | setUsername(e.target.value)}
22 | placeholder="Email"
23 | />
24 | {
28 | setPassword(e.target.value);
29 | }}
30 | placeholder="Password"
31 | />
32 | submit
33 |
34 | );
35 | };
36 |
37 | export default Login;
38 |
--------------------------------------------------------------------------------
/context_API-2/src/App.jsx:
--------------------------------------------------------------------------------
1 | import { useState,useEffect } from "react";
2 | import "./App.css";
3 | import ThemeBtn from "./component/ThemeBtn";
4 | import Card from "./component/Card";
5 | import { ThemeContextProvider } from "./context/Theme";
6 |
7 | function App() {
8 | const [themeMode, setThemeMode] = useState("light");
9 | const lightTheme = () => {
10 | setThemeMode("light");
11 | };
12 | const darkTheme = () => {
13 | setThemeMode("dark");
14 | };
15 |
16 | useEffect(() => {
17 | document.querySelector("html").classList.remove("light", "dark");
18 | document.querySelector("html").classList.add(themeMode);
19 | }, [themeMode]);
20 |
21 | return (
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | );
35 | }
36 |
37 | export default App;
38 |
--------------------------------------------------------------------------------
/redux-tool/src/components/AddTodo.jsx:
--------------------------------------------------------------------------------
1 | import React, {useState} from 'react'
2 | import {useDispatch} from 'react-redux'
3 | import {addTodo} from '../features/todo/todoSlice'
4 |
5 | function AddTodo() {
6 |
7 | const [input,setInput] = useState("");
8 | const dispatch = useDispatch(); // dispatcher is uses reducers to make changes into the store ⭐
9 |
10 | const addTodoHandler = (e)=>{
11 | e.preventDefault();
12 | dispatch(addTodo(input)); // calling reducers by passing (action payload) input
13 | setInput("")
14 | }
15 |
16 | return (
17 |
32 | )
33 | }
34 |
35 | export default AddTodo
--------------------------------------------------------------------------------
/context_API-2/src/component/ThemeBtn.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import useTheme from "../context/Theme";
3 |
4 | export default function ThemeBtn() {
5 | const { themeMode, lightTheme, darkTheme } = useTheme();
6 |
7 | const handleTheme = (e) => {
8 | const darkThemeStatus = e.currentTarget.checked;
9 | if (darkThemeStatus) {
10 | darkTheme();
11 | } else {
12 | lightTheme();
13 | }
14 | };
15 |
16 | return (
17 |
18 | {
23 | return handleTheme(e);
24 | }}
25 | checked={themeMode === "dark"}
26 | />
27 |
28 |
29 | Toggle Theme
30 |
31 |
32 | );
33 | }
34 |
--------------------------------------------------------------------------------
/context_API/src/index.css:
--------------------------------------------------------------------------------
1 | :root {
2 | font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
3 | line-height: 1.5;
4 | font-weight: 400;
5 |
6 | color-scheme: light dark;
7 | color: rgba(255, 255, 255, 0.87);
8 | background-color: #242424;
9 |
10 | font-synthesis: none;
11 | text-rendering: optimizeLegibility;
12 | -webkit-font-smoothing: antialiased;
13 | -moz-osx-font-smoothing: grayscale;
14 | }
15 |
16 | a {
17 | font-weight: 500;
18 | color: #646cff;
19 | text-decoration: inherit;
20 | }
21 | a:hover {
22 | color: #535bf2;
23 | }
24 |
25 | body {
26 | margin: 0;
27 | display: flex;
28 | place-items: center;
29 | min-width: 320px;
30 | min-height: 100vh;
31 | }
32 |
33 | h1 {
34 | font-size: 3.2em;
35 | line-height: 1.1;
36 | }
37 |
38 | button {
39 | border-radius: 8px;
40 | border: 1px solid transparent;
41 | padding: 0.6em 1.2em;
42 | font-size: 1em;
43 | font-weight: 500;
44 | font-family: inherit;
45 | background-color: #1a1a1a;
46 | cursor: pointer;
47 | transition: border-color 0.25s;
48 | }
49 | button:hover {
50 | border-color: #646cff;
51 | }
52 | button:focus,
53 | button:focus-visible {
54 | outline: 4px auto -webkit-focus-ring-color;
55 | }
56 |
57 | @media (prefers-color-scheme: light) {
58 | :root {
59 | color: #213547;
60 | background-color: #ffffff;
61 | }
62 | a:hover {
63 | color: #747bff;
64 | }
65 | button {
66 | background-color: #f9f9f9;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/redux-tool/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/context_API-2/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/context_API/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/context_API_LS/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/custom-hooks/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/react-bg-btn/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/react-hooks/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/react-router/public/vite.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/react-bg-btn/src/components/card.jsx:
--------------------------------------------------------------------------------
1 | function Card({
2 | data,
3 | data2 = "You can manage phone, email and chat conversations all from a single mailbox.",
4 | }) {
5 | return (
6 | <>
7 |
8 |
9 | 4.3
10 |
11 |
12 |
13 |
20 |
26 |
27 |
28 |
29 | Science of {data}
30 |
31 |
32 |
{data2}
33 |
34 |
35 | >
36 | );
37 | }
38 | export default Card;
39 |
--------------------------------------------------------------------------------
/react-router/src/main.jsx:
--------------------------------------------------------------------------------
1 | import { StrictMode } from "react";
2 | import { createRoot } from "react-dom/client";
3 | import "./index.css";
4 | import App from "./App.jsx";
5 | import {
6 | createBrowserRouter,
7 |
8 | createRoutesFromElements,
9 | Route,
10 | RouterProvider,
11 | } from "react-router-dom";
12 | import Home from "./components/Home/Home.jsx";
13 | import About from "./components/About/About.jsx";
14 | import Contact from "./components/Contact/Contact.jsx";
15 | import Github from "./components/GitHub/Github.jsx";
16 | import User from "./components/User/User.jsx";
17 | // const router = createBrowserRouter([
18 | // {
19 | // path: "/",
20 | // element: ,
21 | // children: [
22 | // {
23 | // path: "",
24 | // element: ,
25 | // },
26 | // {
27 | // path: "about",
28 | // element: ,
29 | // },
30 | // ],
31 | // },
32 | // ]);
33 |
34 | const router = createBrowserRouter(
35 | createRoutesFromElements(
36 | }>
37 | } />
38 | } />
39 | } />
40 | } />
41 | }/>
42 |
43 | )
44 | );
45 | createRoot(document.getElementById("root")).render(
46 |
47 |
48 |
49 | );
50 |
--------------------------------------------------------------------------------
/react-router/src/components/About/About.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | export default function About() {
4 | return (
5 |
6 |
7 |
8 |
9 |
13 |
14 |
15 |
16 | React development is carried out by passionate developers
17 |
18 |
19 | Lorem ipsum dolor, sit amet consectetur adipisicing elit. Eum omnis voluptatem
20 | accusantium nemo perspiciatis delectus atque autem! Voluptatum tenetur beatae unde
21 | aperiam, repellat expedita consequatur! Officiis id consequatur atque doloremque!
22 |
23 |
24 | Nobis minus voluptatibus pariatur dignissimos libero quaerat iure expedita at?
25 | Asperiores nemo possimus nesciunt dicta veniam aspernatur quam mollitia.
26 |
27 |
28 |
29 |
30 |
31 | );
32 | }
--------------------------------------------------------------------------------
/custom-hooks/currency.md:
--------------------------------------------------------------------------------
1 | # notes for currency converter app
2 |
3 | ## api link
4 |
5 | ```javascript
6 | let url = `https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies/${currency}.json`
7 | // let url = `https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/usd.json
8 |
9 |
10 |
11 | ```
12 |
13 | ## input box
14 |
15 | ```javascript
16 |
17 | function InputBox({
18 | label,
19 |
20 | className = "",
21 | }) {
22 |
23 |
24 | return (
25 |
26 |
27 |
28 | label
29 |
30 |
36 |
37 |
38 |
Currency Type
39 |
43 |
44 |
45 | usd
46 |
47 |
48 |
49 |
50 |
51 | );
52 | }
53 |
54 | export default InputBox;
55 |
56 | ```
57 |
58 |
59 | ## app js
60 |
61 | ```javascript
62 | function App() {
63 |
64 |
65 |
66 |
67 | ```
--------------------------------------------------------------------------------
/custom-hooks/src/components/Input.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { useId } from "react";
3 |
4 | function Input({
5 | label,
6 | amount,
7 | onAmountChange,
8 | onCurrencyChange,
9 | currencyOption = [],
10 | selectCurrency = "usd",
11 | amountDisable = false,
12 | currencyDisable = false,
13 | className = "",
14 | }) {
15 | const amountInputID = useId();
16 |
17 | return (
18 |
19 |
20 |
24 | {label}
25 |
26 | onAmountChange && onAmountChange(Number(e.target.value))}
34 | />
35 |
36 |
37 |
Currency Type
38 |
onCurrencyChange && onCurrencyChange(e.target.value)}
43 | >
44 | {currencyOption.map((currency) => (
45 |
46 | {currency.toUpperCase()}
47 |
48 | ))}
49 |
50 |
51 |
52 | );
53 | }
54 |
55 | export default Input;
56 |
--------------------------------------------------------------------------------
/redux-tool/src/components/Todos.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { useSelector, useDispatch } from 'react-redux'
3 | import {removeTodo} from '../features/todo/todoSlice'
4 |
5 | function Todos() {
6 | const todos = useSelector(state => state.todos)
7 | const dispatch = useDispatch()
8 |
9 | return (
10 | <>
11 | Todos
12 |
13 | {todos.map((todo) => (
14 |
18 | {todo.text}
19 | dispatch(removeTodo(todo.id))}
21 | className="text-white bg-red-500 border-0 py-1 px-4 focus:outline-none hover:bg-red-600 rounded text-md"
22 | >
23 |
31 |
36 |
37 |
38 |
39 | ))}
40 |
41 | >
42 | )
43 | }
44 |
45 | export default Todos
--------------------------------------------------------------------------------
/react-bg-btn/src/App.jsx:
--------------------------------------------------------------------------------
1 | import { useEffect, useState } from "react";
2 | import "./App.css";
3 |
4 | function App() {
5 | const [BGcolor, setBGcolor] = useState(0);
6 | function changeBG(e) {
7 | // e.preventDefault();
8 | setBGcolor(e.target.innerText);
9 | // console.log(e.target.innerText)
10 | }
11 |
12 | useEffect(() => {
13 | document.body.style.backgroundColor = BGcolor;
14 | },[BGcolor]);
15 |
16 | return (
17 | <>
18 |
19 | Hello Manoj | Welcome to react
20 |
21 |
22 |
23 |
27 | green
28 |
29 |
33 | red
34 |
35 |
39 | blue
40 |
41 |
42 |
43 |
47 | violet
48 |
49 |
53 | pink
54 |
55 |
59 | orange
60 |
61 |
62 |
63 | >
64 | );
65 | }
66 |
67 | export default App;
68 |
--------------------------------------------------------------------------------
/context_API_LS/src/components/TodoItem.jsx:
--------------------------------------------------------------------------------
1 | import React,{useState} from "react";
2 | import { useTodo } from "../context/TodoContext";
3 | function TodoItem({ todo }) {
4 | const [isTodoEditable, setIsTodoEditable] = useState(false);
5 | const [todoMsg, setTodoMsg] = useState(todo.todo);
6 | const { updateTodo, deleteTodo, toggleTodo } = useTodo();
7 |
8 | const editTodo = ( ) => {
9 | updateTodo(todo.id, { ...todo, todo: todoMsg });
10 | setIsTodoEditable(false);
11 | };
12 | const toggleCompleted = () => {
13 | toggleTodo(todo.id);
14 | };
15 | return (
16 |
21 |
27 | setTodoMsg(e.target.value)}
34 | readOnly={!isTodoEditable}
35 | />
36 | {/* Edit, Save Button */}
37 | {
40 | if (todo.completed) return;
41 |
42 | if (isTodoEditable) {
43 | editTodo();
44 | } else setIsTodoEditable((prev) => !prev);
45 | }}
46 | disabled={todo.completed}
47 | >
48 | {isTodoEditable ? "📁" : "✏️"}
49 |
50 | {/* Delete Todo Button */}
51 | deleteTodo(todo.id)}
54 | >
55 | ❌
56 |
57 |
58 | );
59 | }
60 |
61 | export default TodoItem;
62 |
--------------------------------------------------------------------------------
/context_API_LS/src/App.jsx:
--------------------------------------------------------------------------------
1 | import { useState, useEffect } from "react";
2 | import TodoForm from "./components/TodoForm.jsx";
3 | import "./App.css";
4 | import { TodoContextProvider } from "./context/TodoContext.js";
5 | import TodoItem from "./components/TodoItem.jsx";
6 | // import TodoItem from "./components/TodoItem.jsx";
7 |
8 | function App() {
9 | const [todos, setTodos] = useState([]);
10 |
11 | const addTodo = (todo) => {
12 | // console.log("todo : ", todo);
13 | setTodos((prev) => [...prev, { id: Date.now(), ...todo }]);
14 | };
15 | const updateTodo = (id, todo) => {
16 | setTodos((prev) =>
17 | prev.map((prevTodo) => (prevTodo.id === id ? todo : prevTodo))
18 | );
19 | };
20 | const deleteTodo = (id) => {
21 | setTodos((prev) => prev.filter((prevTodo) => prevTodo.id !== id));
22 | };
23 | const toggleTodo = (id) => {
24 | setTodos((prev) =>
25 | prev.map((prevTodo) =>
26 | prevTodo.id === id
27 | ? { ...prevTodo, completed: !prevTodo.completed }
28 | : prevTodo
29 | )
30 | );
31 | };
32 |
33 | // upon first loading , get from the local storage
34 | useEffect(() => {
35 | // localStorage.clear()
36 | const todos = JSON.parse(localStorage.getItem("todos")); // getItem (key)
37 | console.log(todos);
38 |
39 | if (todos && todos.length > 0) {
40 | setTodos(todos);
41 | }
42 | }, []);
43 |
44 | // another useEffect for whenever todos are added , then need added into local storage
45 | useEffect(() => {
46 | localStorage.setItem("todos", JSON.stringify(todos));
47 | }, [todos]);
48 | return (
49 |
52 |
53 |
54 |
55 | Manage Your Todos
56 |
57 |
58 |
59 |
60 |
61 | {/*Loop and Add TodoItem here */}
62 | {todos.map((todo) => (
63 |
64 |
65 |
66 | ))}
67 |
68 |
69 |
70 |
71 | );
72 | }
73 |
74 | export default App;
75 |
--------------------------------------------------------------------------------
/react-router/src/components/Home/Home.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { Link } from 'react-router-dom';
3 |
4 | export default function Home() {
5 | return (
6 |
7 |
8 |
9 |
10 |
11 | Download Now
12 | Lorem Ipsum
13 |
14 |
15 |
19 |
27 |
28 |
29 | Download now
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
Lorem Ipsum Yojo
44 |
45 | );
46 | }
--------------------------------------------------------------------------------
/custom-hooks/src/App.jsx:
--------------------------------------------------------------------------------
1 | import { useState } from "react";
2 | import { Input } from "./components";
3 | import useCurrencyInfo from "./hooks/useCurrencyInfo";
4 |
5 | function App() {
6 | const [amount, setAmount] = useState(1);
7 | const [from, setFrom] = useState("usd");
8 | const [to, setTo] = useState("inr");
9 | const [convertedAmount, setConvertedAmount] = useState(0);
10 |
11 | const currencyInfo = useCurrencyInfo(from);
12 | const options = Object.keys(currencyInfo || {});
13 |
14 | const swap = () => {
15 | setFrom(to);
16 | setTo(from);
17 | setAmount(convertedAmount);
18 | setConvertedAmount(amount);
19 | };
20 |
21 | const convert = () => {
22 | if (currencyInfo[to]) {
23 | setConvertedAmount(amount * currencyInfo[to]);
24 | }
25 | };
26 |
27 | return (
28 |
81 | );
82 | }
83 |
84 | export default App;
85 |
--------------------------------------------------------------------------------
/react-hooks/src/App.jsx:
--------------------------------------------------------------------------------
1 | import { useEffect, useRef, useState } from "react";
2 | import "./App.css";
3 | import { useCallback } from "react";
4 |
5 | function App() {
6 | const [length, setLength] = useState(8);
7 | const [number, setNumber] = useState(false);
8 | const [character, setCharacter] = useState(false);
9 | const [password, setPassword] = useState("");
10 |
11 | // useRef hook
12 | const passwordRef = useRef(null);
13 |
14 | const passwordGenerator = useCallback(() => {
15 | let pass = "";
16 | let str = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm";
17 | if (number) str += "0123456789";
18 | if (character) str += "!@#$%^&*(){}:<>?~_+-";
19 |
20 | for (let i = 1; i <= length; i++) {
21 | let char = Math.floor(Math.random() * str.length + 1);
22 | pass += str.charAt(char);
23 | }
24 | setPassword(pass);
25 | }, [number, character, length, setPassword, length]); // for optimization
26 |
27 | useEffect(() => {
28 | passwordGenerator();
29 | }, [number, character, length, setPassword, length]); // for every change of state
30 |
31 | const copyToClibboard = useCallback(() => {
32 | passwordRef.current?.select();
33 | passwordRef.current?.setSelectionRange(6, 9);
34 | window.navigator.clipboard.writeText(password);
35 | }, [password]);
36 |
37 | return (
38 | <>
39 |
40 |
41 | Pasword Generator
42 |
43 |
44 |
52 |
56 | copy
57 |
58 |
59 |
101 |
102 | >
103 | );
104 | }
105 |
106 | export default App;
107 |
--------------------------------------------------------------------------------
/context_API/src/assets/react.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/react-hooks/src/assets/react.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/redux-tool/src/assets/react.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/context_API-2/src/assets/react.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/context_API_LS/src/assets/react.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/custom-hooks/src/assets/react.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/react-bg-btn/src/assets/react.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/react-router/src/assets/react.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/react-router/src/components/Header/Header.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import {Link , NavLink} from 'react-router-dom'
3 |
4 | export default function Header() {
5 | return (
6 |
7 |
8 |
9 |
10 |
15 |
16 |
17 |
21 | Log in
22 |
23 |
27 | Get started
28 |
29 |
30 |
78 |
79 |
80 |
81 | );
82 | }
83 |
--------------------------------------------------------------------------------
/context_API-2/src/component/Card.jsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export default function Card() {
4 | return (
5 |
82 | );
83 | }
84 |
--------------------------------------------------------------------------------
/react-router/src/components/Contact/Contact.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | export default function Contact() {
4 | return (
5 |
6 |
7 |
8 |
9 |
10 |
11 | Get in touch:
12 |
13 |
14 | Fill in the form to start a conversation
15 |
16 |
17 |
18 |
27 |
33 |
39 |
40 |
41 | Acme Inc, Street, State, Postal Code
42 |
43 |
44 |
45 |
46 |
55 |
61 |
62 |
63 | +44 1234567890
64 |
65 |
66 |
67 |
68 |
77 |
83 |
84 |
85 | info@acme.org
86 |
87 |
88 |
89 |
90 |
137 |
138 |
139 |
140 |
141 | );
142 | }
--------------------------------------------------------------------------------
/react-router/src/components/Footer/Footer.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { Link } from 'react-router-dom';
3 |
4 | export default function Footer() {
5 | return (
6 |
7 |
8 |
9 |
10 |
11 |
16 |
17 |
18 |
19 |
20 |
Resources
21 |
22 |
23 |
24 | Home
25 |
26 |
27 |
28 |
29 | About
30 |
31 |
32 |
33 |
34 |
54 |
55 |
Legal
56 |
57 |
58 |
59 | Privacy Policy
60 |
61 |
62 |
63 |
64 | Terms & Conditions
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | © 2023
75 |
76 | hiteshchoudhary
77 |
78 | . All Rights Reserved.
79 |
80 |
81 |
82 |
89 |
94 |
95 |
Facebook page
96 |
97 |
98 |
105 |
106 |
107 |
Discord community
108 |
109 |
110 |
117 |
122 |
123 |
Twitter page
124 |
125 |
126 |
133 |
138 |
139 |
GitHub account
140 |
141 |
142 |
149 |
154 |
155 |
Dribbble account
156 |
157 |
158 |
159 |
160 |
161 | );
162 | }
--------------------------------------------------------------------------------