-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.txt
More file actions
56 lines (49 loc) · 1.52 KB
/
basic.txt
File metadata and controls
56 lines (49 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
1. create-react-app
2. app.js - импорт высокоуровневых тегов-компонентов <Header/>
3. Папка components:
Header.jxs, Header.module.css - export default
4.Компонент - это функция, которая возвращает разметку (jsx)
В каждый компонент передается props.
Пример:
<div>
<Post message="Hola" like="20" />
</div>
const Post = (props) => {
return (
<div>
{props.message}
{props.like}
</div>
);
};
5.Системма роутинга - системма маршрутов
npm install react-router-dom --save
--save - добавляет запись в packet.json
<a> в React назыв. NavLink, переключение по
вкаладкам без перезагрузки страницы
Пример:
<div className={s.item}>
<NavLink to="/profile">Profile</NavLink>
</div>
<BrowserRouter>
<Routes>
<Route path="/dialogs" element= {<Dialogs/>}/>
<Route path="/profile" element={<Profile/>}/>
</Routes>
</BrowserRouter>
======================================
Grid
.app-wrapper{
display: grid;
width: 1200px;
margin: 0 auto;
grid-template-areas:
"header header"
"nav content";
grid-template-rows: 60px 1fr;
grid-template-columns: 2fr 10fr; // соотношение фракций
grid-gap: 10px; // пробел в сетке
}
.app-wrapper-content{
grid-area: content; //псевдоним, в каждом классе
}