- ThemeProvider; const ThemeContext = React.createContext('primary'); - ThemeContext">
| const ThemeContext = React.createContext('primary'); | Kontext, przetrzymuje informacje |
| static contextType = ThemeContext; | Kontext |
| <ThemeContext.Provider value="secondary"> | ThemeProvider |
| const ThemeContext = React.createContext('primary'); | ThemeContext |
| <ThemeContext.Consumer> {value =>} | ThemeConsumer |
| {props.children} | wyswietla Komponenty swoich dzieci np. <Header><xD /><xD2 /></Header> |
| ({theme}) => zamiast: obj => co daje nam: obj.theme | destrukturyzacja, czyli zamiast odnosic sie do obj.theme, dzieki temu wystarczy samo 'theme' |
| x | useContext() |
| Wynoszą funkcje z komponentow klasowych do funkc. | Hook |
| useEffect() = componentDidMount, tylko ze w funkcji | useEffect() |
| focus() | focus() |
| uruchom ta funkcje za kazdym renderowaniem | useEffect(); |
| 18. export default React.memo(Hotels) ; | w funkcji, komponent dzieki temu renderuje sie tylko gdy jest potrzeba |
| 18. export default React.memo(Hotels, areEqual) ; | areEqual-sprawdza czy poprzednie i aktualne propsy sa takie same |
| biblioteka do formatowania, zarzadzania czasem (hh:mm) itp. | npm i moment |
| const leftTime = moment().diff(endTime); | .to(endTime) | moment - aktualny czas | .diff(roznica), |.to - do takiego czasu |
| funkcja tylko pomniejszona | hook |
| Zmiana stron | routing |
| event gdy element sie usunie | onRemove = {} |
| instaluje react router | npm i react-router-dom |