What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-17 19:22:03
react responsive screen size
const MyComponent = () => { // Declare a new state variable with the "useState" Hook const [width, setWidth] = React.useState(window.innerWidth); const breakpoint = 620; React.useEffect(() => { /* Inside of a "useEffect&q... Add solution -
Javascript 2021-09-20 19:20:03
select value from select and pass it to useeffect
const GetAPILinks = () => { const [apiData, setApiData] = React.useState([]); const [fetchUrl, setFetchUrl] = React.useState(''); React.useEffect(() => { if (fetchUrl) { fetch(fetchUrl) .then((response) => { retu... Add solution -
Javascript 2021-09-17 20:40:02
react eznyme fetch api using hooks
//app.js import React from 'react' import FetchData from './FetchData' const fetchUsers = () => fetch('https://jsonplaceholder.typicode.com/users').then((res) => res.json()) function App() { return ( <> <FetchData fetchUsers={... Add solution -
Javascript 2021-09-17 01:49:01
react native autofocus on text input with keyboard display
const [isFocused, setIsFocued] = React.useState(true) const setFocus = React.useCallback(() => { setIsFocued(true) }, []) const setBlur = React.useCallback(() => { setIsFocued(false) }, []) const navi = useNavigation() Reac... Add solution