├── public ├── favicon.ico ├── logo192.png ├── logo512.png ├── robots.txt ├── manifest.json └── index.html ├── src ├── components │ ├── DateComponent.js │ ├── Groceries.js │ ├── Greeting.js │ ├── Countdown.js │ ├── Interval.js │ ├── TimeInterval.js │ ├── Counter.js │ └── GitHubUser.js ├── hooks │ ├── useIsomorphicLayoutEffect.js │ ├── useCounter.js │ ├── useBoolean.js │ ├── useCustomHookExample.js │ ├── useInterval.js │ └── useCountDown.js ├── setupTests.js ├── App.test.js ├── App.css ├── index.css ├── reportWebVitals.js ├── index.js ├── App.js └── logo.svg ├── .gitignore ├── package.json └── README.md /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nyamador/altschool-react/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nyamador/altschool-react/HEAD/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nyamador/altschool-react/HEAD/public/logo512.png -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /src/components/DateComponent.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | 3 | export default function DateComponent() { 4 | return
Today is {Date()}
5 | } 6 | -------------------------------------------------------------------------------- /src/hooks/useIsomorphicLayoutEffect.js: -------------------------------------------------------------------------------- 1 | import { useEffect, useLayoutEffect } from 'react'; 2 | 3 | const useIsomorphicLayoutEffect = 4 | typeof window !== 'undefined' ? useLayoutEffect : useEffect; 5 | 6 | export default useIsomorphicLayoutEffect; 7 | -------------------------------------------------------------------------------- /src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /src/App.test.js: -------------------------------------------------------------------------------- 1 | import { render, screen } from '@testing-library/react'; 2 | import App from './App'; 3 | 4 | test('renders learn react link', () => { 5 | render(); 6 | const linkElement = screen.getByText(/learn react/i); 7 | expect(linkElement).toBeInTheDocument(); 8 | }); 9 | -------------------------------------------------------------------------------- /src/App.css: -------------------------------------------------------------------------------- 1 | p { 2 | margin: 5px; 3 | } 4 | .card-details .card-name { 5 | font-size: 24px; 6 | line-height: 1.25; 7 | } 8 | .card-details .card-username { 9 | font-size: 20px; 10 | font-style: normal; 11 | font-weight: 300; 12 | line-height: 24px; 13 | color: #57606a; 14 | } 15 | .card-details .card-bio { 16 | } 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = onPerfEntry => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 4 | getCLS(onPerfEntry); 5 | getFID(onPerfEntry); 6 | getFCP(onPerfEntry); 7 | getLCP(onPerfEntry); 8 | getTTFB(onPerfEntry); 9 | }); 10 | } 11 | }; 12 | 13 | export default reportWebVitals; 14 | -------------------------------------------------------------------------------- /src/hooks/useCounter.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | function useCounter(initialValue) { 4 | const [count, setCount] = React.useState(initialValue || 0); 5 | 6 | const increment = () => setCount((prevValue) => prevValue + 1); 7 | const decrement = () => setCount((prevValue) => prevValue - 1); 8 | const reset = () => setCount(initialValue || 0); 9 | 10 | return { 11 | count, 12 | increment, 13 | decrement, 14 | reset, 15 | setCount, 16 | }; 17 | } 18 | 19 | export default useCounter; 20 | -------------------------------------------------------------------------------- /src/hooks/useBoolean.js: -------------------------------------------------------------------------------- 1 | import { useCallback, useState } from 'react' 2 | 3 | 4 | 5 | function useBoolean(defaultValue) { 6 | // state to manage the useCustomHook 7 | const [value, setValue] = useState(!!defaultValue) 8 | 9 | // create the data to be returned by the useCustomHook 10 | const toggle = useCallback(() => setValue(prevValue => !prevValue), []) 11 | const setTrue = useCallback(() => setValue(true), []) 12 | const setFalse = useCallback(() => setValue(false), []) 13 | 14 | return { 15 | value, toggle, setTrue, setFalse 16 | } 17 | } 18 | 19 | export default useBoolean 20 | -------------------------------------------------------------------------------- /src/components/Groceries.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | 3 | export default function Groceries() { 4 | // const myGroceries = ["Apple", "Banana", "Orange"] 5 | const myGroceries = [ 6 | { 7 | id: 1, 8 | name: "Apple", 9 | }, 10 | { 11 | id: 2, 12 | name: "Orange", 13 | }, 14 | ] 15 | 16 | const groceryLogger = (e) => { 17 | console.log(`You clicked the ${e.target.innerText} button`) 18 | } 19 | return myGroceries.map((grocery) => ( 20 | 23 | )) 24 | } 25 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | const root = ReactDOM.createRoot(document.getElementById('root')); 8 | root.render( 9 | 10 | 11 | 12 | ); 13 | 14 | // If you want to start measuring performance in your app, pass a function 15 | // to log results (for example: reportWebVitals(console.log)) 16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 17 | reportWebVitals(); 18 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /src/hooks/useCustomHookExample.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react' 2 | 3 | export default function useCustomHook(type) { 4 | // state 5 | const [data, setData] = React.useState([]) 6 | 7 | React.useEffect(() => { 8 | if (type === 'cars') { 9 | const cars = [ 10 | { id: 1, name: 'Tesla' }, 11 | { id: 2, name: 'BMW' }, 12 | { id: 3, name: 'Jeep' }, 13 | ] 14 | setData(cars) 15 | } else if (type === 'books') { 16 | const books = [ 17 | { id: 1, name: 'Harry Potter' }, 18 | { id: 2, name: 'Lord of the Rings' }, 19 | { id: 3, name: 'Lion King' }, 20 | ] 21 | setData(books) 22 | } else { 23 | setData([]) 24 | } 25 | }, [type]) 26 | 27 | // return data 28 | // return [data, setData] 29 | return {data, setData} 30 | } -------------------------------------------------------------------------------- /src/components/Greeting.js: -------------------------------------------------------------------------------- 1 | // const Greeting = () => { 2 | // const [name, setName] = useState(''); 3 | // console.log(name); 4 | // return ( 5 | //
6 | //

I am a Greeting Component

7 | // {name !== '' ?

My name is {name}

:

No Name

} 8 | //
9 | // ); 10 | // }; 11 | 12 | import React from 'react'; 13 | 14 | export default function Greeting(prop) { 15 | // let stateDispatcher = React.useState('Desmond') 16 | // const name = stateDispatcher[0] 17 | // const changeName = stateDispatcher[1] 18 | 19 | // destructured 20 | const [name, setName] = React.useState('Desmond'); 21 | 22 | 23 | 24 | const pElement =

Hello Greeting, My name is {name}

25 | return ( 26 |
setName('AltSchool')}>{ pElement}
27 | ) 28 | } 29 | -------------------------------------------------------------------------------- /src/hooks/useInterval.js: -------------------------------------------------------------------------------- 1 | import { useEffect, useRef } from 'react'; 2 | 3 | // See: https://usehooks-ts.com/react-hook/use-isomorphic-layout-effect 4 | import useIsomorphicLayoutEffect from './useIsomorphicLayoutEffect'; 5 | 6 | function useInterval(callback, delay) { 7 | const savedCallback = useRef(callback); 8 | 9 | // Remember the latest callback if it changes. 10 | useIsomorphicLayoutEffect(() => { 11 | savedCallback.current = callback; 12 | }, [callback]); 13 | 14 | // Set up the interval. 15 | useEffect(() => { 16 | // Don't schedule if no delay is specified. 17 | // Note: 0 is a valid value for delay. 18 | if (!delay && delay !== 0) { 19 | return; 20 | } 21 | 22 | const id = setInterval(() => savedCallback.current(), delay); 23 | 24 | return () => clearInterval(id); 25 | }, [delay]); 26 | } 27 | 28 | export default useInterval; 29 | -------------------------------------------------------------------------------- /src/components/Countdown.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | 3 | import useCountdown from '../hooks/useCountDown'; 4 | 5 | export default function Countdown() { 6 | const [intervalValue, setIntervalValue] = useState(10); 7 | const [count, { startCountdown, stopCountdown, resetCountdown }] = 8 | useCountdown({ 9 | countStart: 0, 10 | countStop: 9999, 11 | intervalMs: intervalValue, 12 | isIncrement: true 13 | }); 14 | 15 | const handleChangeIntervalValue = (event) => { 16 | setIntervalValue(Number(event.target.value)); 17 | }; 18 | return ( 19 |
20 |

Count: {count}

21 | 22 | 27 | 28 | 29 | 30 |
31 | ); 32 | } 33 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "altschool-react", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@testing-library/jest-dom": "^5.14.1", 7 | "@testing-library/react": "^13.0.0", 8 | "@testing-library/user-event": "^13.2.1", 9 | "react": "^18.2.0", 10 | "react-dom": "^18.2.0", 11 | "react-router-dom": "6", 12 | "react-scripts": "5.0.1", 13 | "web-vitals": "^2.1.0" 14 | }, 15 | "scripts": { 16 | "start": "react-scripts start", 17 | "build": "react-scripts build", 18 | "test": "react-scripts test", 19 | "eject": "react-scripts eject" 20 | }, 21 | "eslintConfig": { 22 | "extends": [ 23 | "react-app", 24 | "react-app/jest" 25 | ] 26 | }, 27 | "browserslist": { 28 | "production": [ 29 | ">0.2%", 30 | "not dead", 31 | "not op_mini all" 32 | ], 33 | "development": [ 34 | "last 1 chrome version", 35 | "last 1 firefox version", 36 | "last 1 safari version" 37 | ] 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/components/Interval.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | 3 | import useInterval from '../hooks/useInterval'; 4 | 5 | export default function Interval() { 6 | // The counter 7 | const [count, setCount] = useState(0); 8 | // Dynamic delay 9 | const [delay, setDelay] = useState(1000); 10 | // ON/OFF 11 | const [isPlaying, setPlaying] = useState(false); 12 | 13 | useInterval( 14 | () => { 15 | // Your custom logic here 16 | setCount(count + 1); 17 | }, 18 | // Delay in milliseconds or null to stop it 19 | isPlaying ? delay : null 20 | ); 21 | 22 | const handleChange = (event) => { 23 | setDelay(Number(event.target.value)); 24 | }; 25 | 26 | return ( 27 | <> 28 |

{count}

29 | 32 |

33 | 34 | 40 |

41 | 42 | ); 43 | } 44 | -------------------------------------------------------------------------------- /src/components/TimeInterval.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | 3 | import useInterval from '../hooks/useInterval'; 4 | 5 | export default function Interval() { 6 | // The counter 7 | const [count, setCount] = useState(Date.now()); 8 | // Dynamic delay 9 | const [delay, setDelay] = useState(1000); 10 | // ON/OFF 11 | const [isPlaying, setPlaying] = useState(false); 12 | 13 | useInterval( 14 | () => { 15 | // Your custom logic here 16 | setCount(count + 1); 17 | }, 18 | // Delay in milliseconds or null to stop it 19 | isPlaying ? delay : null 20 | ); 21 | 22 | const handleChange = (event) => { 23 | setDelay(Number(event.target.value)); 24 | }; 25 | 26 | return ( 27 | <> 28 |

{new Date().toISOString()}

29 | 32 |

33 | 34 | 40 |

41 | 42 | ); 43 | } 44 | -------------------------------------------------------------------------------- /src/components/Counter.js: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | 3 | function Counter() { 4 | let [value, setValue] = useState(1); 5 | 6 | const handleIncrement = (e) => { 7 | setValue(value + 1); 8 | console.log('Increment was clicked'); 9 | }; 10 | 11 | const handleDecrement = () => { 12 | if (value <= 0) { 13 | setValue((prev) => { 14 | console.log('prev:', prev); 15 | 16 | return 0; 17 | }); 18 | } else { 19 | setValue(value - 1); 20 | } 21 | 22 | console.log('Decrement was clicked'); 23 | }; 24 | 25 | const handleReset = () => { 26 | setValue(0); 27 | console.log('Reset was clicked'); 28 | }; 29 | 30 | 31 | // effect 32 | React.useEffect(() => { 33 | // document.title = `I changed the state of my counter component` 34 | console.log('useEffect was called') 35 | // addEventListener 36 | // clean up 37 | // removeEventListener 38 | 39 | }, [value]) 40 | 41 | return ( 42 | <> 43 |

{value}

44 | 45 | 46 | 47 | 48 | ); 49 | } 50 | 51 | export default Counter; -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import React, { useRef } from 'react'; 2 | import './App.css'; 3 | import Countdown from './components/Countdown'; 4 | import Interval from './components/Interval'; 5 | import useBoolean from './hooks/useBoolean'; 6 | import useCounter from './hooks/useCounter'; 7 | 8 | // console.log(React.useState) 9 | 10 | 11 | 12 | 13 | 14 | function App() { 15 | // const data = useCustomHook('books') 16 | // console.log('data:', data) 17 | const domRef = useRef(null) 18 | console.log(domRef.current) 19 | 20 | if (domRef.current) { 21 | domRef.current.textContent = 'Changed Button Name' 22 | } 23 | 24 | const { value, toggle } = useBoolean(false); 25 | const {count, increment, decrement, reset, setCount} = useCounter(8) 26 | 27 | return ( 28 | <> 29 | {value &&

My name is Desmond

} 30 | 31 |
32 |

count: {count}

33 | 34 | 35 | 36 | 37 | 38 |
39 | 40 | 41 | {/*
42 | 43 | 44 | 45 | 46 |
*/} 47 | 48 | ); 49 | } 50 | 51 | export default App; 52 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/components/GitHubUser.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | function GitHubUser() { 4 | let [data, setData] = React.useState({}); 5 | let [isHover, setIsHover] = React.useState(false) 6 | 7 | const handleMouseEnter = () => { 8 | setIsHover(true); 9 | }; 10 | const handleMouseLeave = () => { 11 | setIsHover(false); 12 | }; 13 | 14 | React.useEffect(() => { 15 | async function gitHubApiCall() { 16 | const res = await fetch('https://api.github.com/users/oluwasetemi'); 17 | const data = await res.json(); 18 | // console.log('data:', data); 19 | setData(data); 20 | } 21 | // document.title = `I changed the state of my counter component` 22 | console.log('useEffect was called'); 23 | // addEventListener 24 | gitHubApiCall(); 25 | // gitHubApiCall2() 26 | }, []); 27 | 28 | if (data?.message) { 29 | return

API was not success: {data.message}

; 30 | } 31 | 32 | const clickHandler = () => { 33 | window.open(`http://twitter.com/${data.twitter_username}`); 34 | } 35 | 36 | return ( 37 |
43 | {/* 48 | Twitter 49 | */} 50 |
51 | {`${data.name}`} 56 |
57 |
58 |

{data.name}

59 |

{data.login}

60 |
61 |

{data.bio}

62 |
63 |
64 |
65 | ); 66 | } 67 | 68 | export default GitHubUser; 69 | -------------------------------------------------------------------------------- /src/hooks/useCountDown.js: -------------------------------------------------------------------------------- 1 | // TODO: example and test 2 | import { useCallback } from 'react'; 3 | 4 | import useBoolean from './useBoolean'; 5 | import useCounter from './useCounter'; 6 | import useInterval from './useInterval'; 7 | 8 | function useCountdown(countdownOption) { 9 | let countStart, intervalMs, isIncrement, countStop; 10 | 11 | if ('seconds' in countdownOption) { 12 | console.warn('error'); 13 | 14 | countStart = countdownOption.seconds; 15 | intervalMs = countdownOption.interval; 16 | isIncrement = countdownOption.isIncrement; 17 | } else { 18 | // eslint-disable-next-line @typescript-eslint/no-extra-semi 19 | ({ countStart, intervalMs, isIncrement, countStop } = countdownOption); 20 | } 21 | 22 | // default values 23 | intervalMs = intervalMs ?? 1000; 24 | isIncrement = isIncrement ?? false; 25 | countStop = countStop ?? 0; 26 | 27 | const { 28 | count, 29 | increment, 30 | decrement, 31 | reset: resetCounter, 32 | } = useCounter(countStart); 33 | 34 | /** 35 | * Note: used to control the useInterval 36 | * running: If true, the interval is running 37 | * start: Should set running true to trigger interval 38 | * stop: Should set running false to remove interval 39 | */ 40 | const { 41 | value: isCountdownRunning, 42 | setTrue: startCountdown, 43 | setFalse: stopCountdown, 44 | } = useBoolean(false); 45 | 46 | /** 47 | * Will set running false and reset the seconds to initial value 48 | */ 49 | const resetCountdown = () => { 50 | stopCountdown(); 51 | resetCounter(); 52 | }; 53 | 54 | const countdownCallback = useCallback(() => { 55 | if (count === countStop) { 56 | stopCountdown(); 57 | return; 58 | } 59 | 60 | if (isIncrement) { 61 | increment(); 62 | } else { 63 | decrement(); 64 | } 65 | }, [count, countStop, decrement, increment, isIncrement, stopCountdown]); 66 | 67 | useInterval(countdownCallback, isCountdownRunning ? intervalMs : null); 68 | 69 | return [ 70 | count, 71 | { 72 | startCountdown, 73 | stopCountdown, 74 | resetCountdown, 75 | }, 76 | ]; 77 | } 78 | 79 | export default useCountdown; 80 | -------------------------------------------------------------------------------- /src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## AltSchoolers Frontend Engineering React live class 2 | 3 | Catch the update of live classes by the instructors [Mr Oluwasetemi](https://github.com/Oluwasetemi) and [Mr Desmond](https://github.com/nyamador/) on this Repo and the available links shared in class 4 | 5 | ###### Month 1 Week 1: 6 | Introduction to React. LMS contd class 7 | During the Introductory lectures to React [Mr Oluwasetemi](https://github.com/Oluwasetemi) break down how bundling of basic javascript app works before the team at facebook created the React, and he delves a little into webpack 8 | [Webpack](https://webpack.js.org/) 9 | 10 | 11 | on the introductiory class, he also mentioned importing, exporting and using our bundled app 12 | [link to the doc he shared here](https://javascript.info/import-export) 13 | 14 | ###### Month 1 Week 2: 15 | ###### Installing create-react-app 16 | 17 | This class focuses us on installing and creating react app on our local machine 18 | [link to create react app](https://create-react-app.dev/) 19 | 20 | as the class proceeds he explain creating components in react, Writing markup with JSX in React. which is just plain javascript and html in react, Importing and Exporting Components, Passing props to a components, Conditional rendering he makes further code examples writting basic jsx elements and rendering them in our react app 21 | 22 | > He further explain the concept of component and how react is component based library for UI rendering 23 | [view class here](#) 24 | 25 | ###### Month 1 Week 3: 26 | 27 | as the classes proceeds he breaks down the concept of states and using states in React, as continuation of the classes on the schol LMS documentation guide below 28 | [States and managing state in React](https://beta.reactjs.org/learn/managing-state) 29 | [Getting started with state](https://reactjs.org/docs/state-and-lifecycle.html) 30 | 31 | ###### some self assesment questions from the instructor posted on frontend engineering slack channel 32 | 33 | ![github-readme-question](https://user-images.githubusercontent.com/64507182/190521102-d7ad57e2-31de-437a-9d8e-f657d8012856.png) 34 | 35 | ###### Month 1 Week 4: 36 | ###### Hooks in React 37 | 38 | [Mr Desmond](https://github.com/nyamador/) and [Mr Oluwasetemi](https://github.com/Oluwasetemi) further use a little counter game of incrementing and decremeting to explain some basic react concepts, which includes the useState hook, useEffect and so on, docs below for further explanation 39 | [useEffect Hook](https://reactjs.org/docs/hooks-effect.html) 40 | 41 | [Mr Setemi](https://github.com/Oluwasetemi) contd to focuses on creating and using custom hooks in react with code examples 42 | [find code here](https://replit.com/@Oluwasetemi/understanding-usefetch?v=1#src/App.jsx) 43 | 44 | ###### Month 2 Week 1: 45 | ###### Hooks contd 46 | 47 | Further classes focus on React router dom, React router dom as a third party library for rounting pages in our React Application. It was explained deeply with examples by the instructor @oluwasetemi, he touches installing the library itself in our app using ```npm install react-router-dom which download other dependencies for us 48 | He went further to explain importing and using with the elements that are provided to us by the library, such as , , 49 | 50 | [The doc he was using in class](https://reactrouter.com/en/main) 51 | 52 | **he further hooks provided by the third party router**
53 | He explained with code example the following 54 | - useLocation 55 | - useParams 56 | - useNavigate 57 | - useOutlet 58 | 59 | [view code here](https://stackblitz.com/edit/vitejs-vite-hswavt?file=src%2FApp.jsx) 60 | [further link](https://replit.com/@Oluwasetemi/understanding-usefetch?v=1#src/App.jsx) 61 | 62 | further link he shared, Input valid github account name 63 | [see here](https://stackblitz.com/edit/vitejs-vite-fdk26g?file=src%2FApp.jsx) 64 | 65 | 66 | **further explanations he made in the last class includes **
67 | - composition vs inheritance using `props.children` and managing layouts in our Application- 68 | 69 | [find doc and code examples here](https://reactjs.org/docs/composition-vs-inheritance.html) 70 | 71 | 72 | ###### Getting Started with this Repo 73 | 74 | Fork the project to a new repositery
75 | clone the repo on your terminal 76 | 77 | cd to the project directory 78 | `code .` to open in your vscode 79 | 80 | ``` 81 | yarn start or 82 | `npm start` to run the app on your local 83 | ``` 84 | 85 | navigate to [localhost:3000](http://localhost:3000) on your browser. 86 | 87 | 88 | This project was bootstrapped with [create react app](https://github.com/facebook/create-react-app). 89 | 90 | --------------------------------------------------------------------------------