react Flashcards
map through json object
{questions.map((question) => {
… }
what to use to navigate between pages ???
we can use 'navigate' from 'react-router-dom' const navigate = useNavigate(); navigate("/dashboard", { replace: true });
do something on change in div element / component
onChange={(e) => setEmail(e.target.value)}
get time in some format [React, JS]
import moment from ‘moment’
useState(moment().format(‘YYYY’))
how to use styles from file
import styles from ‘./local.module.css’;
className={styles.preview}
className={styles[‘container-long-tag’] - if there are some special characters like ‘-‘
how to act if we want to use method from parent in child ???
HostShortForm({isBlocked, block, host}) - here ‘block’ is method from
відступ всередені input
text-indent: 1.5em;
put element on the first position (above all other components)
z-index: 1000;
place by center
left: 50%;
right: 50%;
transform: translate(-50%, -50%);
another method to place something in center
margin-left: auto;
margin-right: auto;