DEV Community

arbarrington
arbarrington

Posted on • Updated on

React Hooks and Component Libraries

To Add:
style components

React
useState - declares a 'state variable' whose value can be preserved between function calls.

const [count, setCount] = useState()
Enter fullscreen mode Exit fullscreen mode

useEffect - call a function (side effect) after the component has rendered

useEffect(() => {
    fetch("http://localhost:4000/leaders")
    .then((r) => r.json())
    .then(setUserResults);
    },[])
Enter fullscreen mode Exit fullscreen mode

React Router DOM Library
useNavigate - navigate the broswer programmatically

Supplementing {Router, Routes, Route}
useParams - returns an object of key/value pairs of the dynamic params from the current URL that were matched by the .
Router, Routes, Route

Top comments (0)