What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-11 19:40:08
react load more listview
import { useState, useEffect, useCallback } from 'react' export const LoadMoreItem = (props) => { const [increment, setIncrement] = useState(4) const [disabled, setDisabled] = useState(false) const [hidden, setHidden] = useState(false) useEffect(... Add solution -
Javascript 2022-02-20 02:40:36
how to pause useState counter value react hoooks
import React, { useState, useEffect } from 'react'; const Timer = () => { const [seconds, setSeconds] = useState(0); const [isActive, setIsActive] = useState(false); function toggle() { setIsActive(!isActive); } function reset() { ... Add solution -
Javascript 2022-02-02 09:21:03
expo image editor
import { ImageEditor } from "expo-image-editor"; function App() { const [imageUri, setImageUri] = useState(undefined); const [editorVisible, setEditorVisible] = useState(false); const selectPhoto = async () => { // Get the permis... Add solution -
Javascript 2022-01-30 17:56:08
audio in react
import React, { useState, useEffect } from "react"; const useAudio = url => { const [audio] = useState(new Audio(url)); const [playing, setPlaying] = useState(false); const toggle = () => setPlaying(!playing); useEffect(() =>... Add solution -
TypeScript 2021-11-21 13:33:07
refreshcontrol
import React from 'react'; import { RefreshControl, SafeAreaView, ScrollView, StyleSheet, Text } from 'react-native'; const wait = (timeout) => { return new Promise(resolve => setTimeout(resolve, timeout)); } const App = () => { const [refr... Add solution -
TypeScript 2021-11-21 07:10:14
react typescript custom hook
export function useLoading() { const [isLoading, setState] = React.useState(false); const load = (aPromise: Promise<any>) => { setState(true); return aPromise.finally(() => setState(false)); }; return [isLoading, load] as const... Add solution -
Javascript 2021-11-20 07:31:10
react hide element
React circa 2020 In the onClick callback, call the state hook's setter function to update the state and re-render: const Search = () => { const [showResults, setShowResults] = React.useState(false) const onClick = () => setShowResults(true) r... Add solution