What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-19 13:59:25
flatlist onrefresh react native
const [isFetching, setIsFetching] = useState(false); const fetchData = () => { dispatch(getAllTopicAction(userParamData)); setIsFetching(false); }; const onRefresh = () => { setIsFetching(true); fetchData(); }; <FlatList data={topics... Add solution -
Other 2021-11-19 10:51:40
Dialog using Reach
function Example(props) { const [showDialog, setShowDialog] = React.useState(false); const open = () => setShowDialog(true); const close = () => setShowDialog(false); return ( <div> <button onClick={open}>Open Dialog</but... Add solution -
Javascript 2021-11-15 22:07:21
how to create dynamic classes in tailwind typescript react
const classes = { wrapper: 'border-2 m-16 p-16 text-center', title: 'text-gray-800 text-xl font-bold', description: (active) => `my-6 ${active ? 'text-red-900 font-medium' : 'text-gray-800'}`, button: 'py-2 px-4 bg-gray-100 border-2 focus:o... Add solution -
Javascript 2021-11-14 17:55:12
Switch React Native Paper
import { Switch } from 'react-native-paper'; const MyComponent = () => { const [isSwitchOn, setIsSwitchOn] = React.useState(false); const onToggleSwitch = () => setIsSwitchOn(!isSwitchOn); return <Switch value={isSwitchOn} onValueChange=... Add solution -
Javascript 2021-11-04 12:28:10
onclick hold react
import { useState, useEffect, useCallback } from 'react'; export default function useLongPress(callback = () => {}, ms = 300) { const [startLongPress, setStartLongPress] = useState(false); useEffect(() => { let timerId; if (startLongPr... Add solution -
Javascript 2021-11-04 11:14:06
next js modal dialog
import React from "react"; // reactstrap components import { Button, Modal, ModalBody, ModalFooter } from "reactstrap"; function Example() { const [modalOpen, setModalOpen] = React.useState(false); return ( <> <... Add solution -
Javascript 2021-10-23 00:23:07
React Custom Hook to load data using API
const useDataFetching = () => { const [data, setData] = useState({ hits: [] }); const [url, setUrl] = useState( 'https://hn.algolia.com/api/v1/search?query=redux', ); const [isLoading, setIsLoading] = useState(false); const [isError, setI... Add solution -
Javascript 2021-10-17 02:11:03
react pagination scroll
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