react Flashcards

1
Q

map through json object

A

{questions.map((question) => {

… }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what to use to navigate between pages ???

A
we can use 'navigate' from 'react-router-dom'
const navigate = useNavigate();
navigate("/dashboard", { replace: true });
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

do something on change in div element / component

A

onChange={(e) => setEmail(e.target.value)}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

get time in some format [React, JS]

A

import moment from ‘moment’

useState(moment().format(‘YYYY’))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

how to use styles from file

A

import styles from ‘./local.module.css’;

className={styles.preview}
className={styles[‘container-long-tag’] - if there are some special characters like ‘-‘

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

how to act if we want to use method from parent in child ???

A

HostShortForm({isBlocked, block, host}) - here ‘block’ is method from

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

відступ всередені input

A

text-indent: 1.5em;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

put element on the first position (above all other components)

A

z-index: 1000;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

place by center

A

left: 50%;
right: 50%;
transform: translate(-50%, -50%);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

another method to place something in center

A

margin-left: auto;

margin-right: auto;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly