Skip to content

Commit b4ea95b

Browse files
committed
ducs: project Setups
1 parent a5b9909 commit b4ea95b

File tree

16 files changed

+317
-57
lines changed

16 files changed

+317
-57
lines changed

README.md

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,7 @@
55
### What is a Library?
66
- A library is a collection of pre-written code that developers can use to optimize tasks, solve problems, or add specific functionality without writing code from scratch.
77
- Libraries typically offer focused functionality and allow developers to control the application’s structure and flow.
8-
- **Examples**:
9-
- **jQuery**: DOM manipulation.
10-
- **D3.js**: Data visualization.
11-
- **Lodash**: Utility functions.
12-
13-
### What is a Framework?
14-
- A framework provides a comprehensive structure for building applications. It defines architecture and enforces a specific approach to development, guiding the flow of the application.
15-
- Frameworks often come with a strict set of rules and conventions and control the application’s flow and lifecycle.
16-
- **Examples**:
17-
- **Angular**
18-
- **Vue.js**
19-
- **Django** (Python)
20-
- **Ruby on Rails**
21-
22-
### Use Cases of Libraries and Frameworks
23-
- **Libraries**: Great for adding modular functionalities in specific areas without changing the overall application structure. Example: Using **D3.js** for data visualizations in an analytics app.
24-
- **Frameworks**: Ideal for building a fully structured application with a consistent flow. Example: Using **Angular** for an enterprise-grade dashboard.
8+
259

2610
### React: Library or Framework?
2711
- React is a **JavaScript library** for building user interfaces, especially single-page applications (SPAs).
@@ -43,9 +27,6 @@ React, created and maintained by **Meta** (Facebook), is a powerful and widely u
4327
## 3. React’s Ecosystem and Tools
4428
React benefits from an extensive ecosystem of tools and libraries that enhance its core functionalities. Some essential tools include:
4529

46-
### 1. Create React App (CRA)
47-
- A CLI tool for setting up a React project with minimal configuration.
48-
- Comes with tools like **Webpack** and **Babel**, enabling developers to focus on coding rather than setup.
4930

5031
### 2. React Developer Tools
5132
- A browser extension to inspect React component hierarchies, check props, and monitor state changes.
@@ -77,11 +58,6 @@ React benefits from an extensive ecosystem of tools and libraries that enhance i
7758
- **State** is a data structure that holds information about a component and can change over time.
7859
- When the state changes, React re-renders the component to reflect the new data.
7960

80-
### 4. Lifecycle Methods (Class Components Only)
81-
- React provides lifecycle methods that are called at specific points in a component’s lifecycle (e.g., `componentDidMount`, `componentDidUpdate`).
82-
- Functional components use **React hooks** (like `useEffect`) for similar functionality.
83-
84-
---
8561

8662
## 5. React’s Supporting Libraries
8763

index.html

Lines changed: 0 additions & 32 deletions
This file was deleted.

props/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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?

props/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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

props/eslint.config.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import react from 'eslint-plugin-react'
4+
import reactHooks from 'eslint-plugin-react-hooks'
5+
import reactRefresh from 'eslint-plugin-react-refresh'
6+
7+
export default [
8+
{ ignores: ['dist'] },
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+
settings: { react: { version: '18.3' } },
21+
plugins: {
22+
react,
23+
'react-hooks': reactHooks,
24+
'react-refresh': reactRefresh,
25+
},
26+
rules: {
27+
...js.configs.recommended.rules,
28+
...react.configs.recommended.rules,
29+
...react.configs['jsx-runtime'].rules,
30+
...reactHooks.configs.recommended.rules,
31+
'react/jsx-no-target-blank': 'off',
32+
'react-refresh/only-export-components': [
33+
'warn',
34+
{ allowConstantExport: true },
35+
],
36+
},
37+
},
38+
]

props/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Vite + React</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.jsx"></script>
12+
</body>
13+
</html>

props/package.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "props",
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": "^18.3.1",
14+
"react-dom": "^18.3.1"
15+
},
16+
"devDependencies": {
17+
"@eslint/js": "^9.13.0",
18+
"@types/react": "^18.3.12",
19+
"@types/react-dom": "^18.3.1",
20+
"@vitejs/plugin-react": "^4.3.3",
21+
"eslint": "^9.13.0",
22+
"eslint-plugin-react": "^7.37.2",
23+
"eslint-plugin-react-hooks": "^5.0.0",
24+
"eslint-plugin-react-refresh": "^0.4.14",
25+
"globals": "^15.11.0",
26+
"vite": "^5.4.10"
27+
}
28+
}

props/public/vite.svg

Lines changed: 1 addition & 0 deletions
Loading

props/src/App.css

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
}

props/src/App.jsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { useState } from 'react'
2+
import reactLogo from './assets/react.svg'
3+
import viteLogo from '/vite.svg'
4+
import './App.css'
5+
6+
function App() {
7+
const [count, setCount] = useState(0)
8+
9+
return (
10+
<>
11+
<div>
12+
<a href="https://vite.dev" target="_blank">
13+
<img src={viteLogo} className="logo" alt="Vite logo" />
14+
</a>
15+
<a href="https://react.dev" target="_blank">
16+
<img src={reactLogo} className="logo react" alt="React logo" />
17+
</a>
18+
</div>
19+
<h1>Vite + React</h1>
20+
<div className="card">
21+
<button onClick={() => setCount((count) => count + 1)}>
22+
count is {count}
23+
</button>
24+
<p>
25+
Edit <code>src/App.jsx</code> and save to test HMR
26+
</p>
27+
</div>
28+
<p className="read-the-docs">
29+
Click on the Vite and React logos to learn more
30+
</p>
31+
</>
32+
)
33+
}
34+
35+
export default App

0 commit comments

Comments
 (0)