What do you want to save?
Add Code snippet
New code examples
-
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-11-04 10:53:12
form in react js
import React, { useState } from "react"; import "./styles.css"; function Form() { const [firstName, setFirstName] = useState(""); const [lastName, setLastName] = useState(""); const [email, setEmail] = useStat... Add solution -
Javascript 2021-11-03 14:24:09
change state in react
import React, { useState } from 'react'; function Example() { // Declare a new state variable, which we'll call "count" const [count, setCount] = useState(0); return ( <div> <p>You clicked {count} times</p> ... Add solution -
Other 2021-11-02 17:23:10
componentDidmount event on fonctional component
import React, { useState, useEffect } from 'react'; function Example() { const [count, setCount] = useState(0); // Similaire à componentDidMount et componentDidUpdate : useEffect(() => { // Met à jour le titre du document via l&r... Add solution -
Javascript 2021-11-02 08:59:07
execute a function on tab click antd
class App extends React.Component { const [activeTabKey, setActiveTabKey] = React.useState('1'); const changeTab = activeKey => { console.log(activeKey); setActiveTabKey(activeKey); }; useEffect(() => { if (activeTabKey === '1... Add solution -
Javascript 2021-10-30 08:40:21
input text react 2020
function LoginForm() { const [email, setEmail] = React.useState(""); const [password, setPassword] = React.useState(""); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); api.login(email, password); ... Add solution -
Javascript 2021-10-29 07:35:09
@material-ui/[email protected]
import React, { Fragment, useState } from "react"; import { TextField } from "@material-ui/core"; import { MobileDatePicker, DesktopDatePicker, DatePicker } from "@material-ui/pickers"; function DatePickersVariants(props) { ... Add solution