What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-02-12 23:30:03
form in react
import React, { useState } from "react"; import "./styles.css"; function Form() { const [firstName, setFirstName] = useState(""); const [lastName, setLastName] = useState(""); const [email, setEmail] = useStat... Add solution -
Other 2022-02-11 22:55:14
changing parent function states in child function
function Parent() { const [value, setValue] = React.useState(""); function handleChange(newValue) { setValue(newValue); } // We pass a callback to Child return <Child value={value} onChange={handleChange} />; } Add solution -
Javascript 2022-01-30 11:35:55
socket io react js
import React, { useState, useEffect } from "react"; import socketIOClient from "socket.io-client"; const ENDPOINT = "http://127.0.0.1:4001"; function App() { const [response, setResponse] = useState(""); useEf... Add solution -
Javascript 2021-11-16 21:11:13
react native socket io
import React, { useState, useEffect } from "react"; import socketIOClient from "socket.io-client"; const ENDPOINT = "http://127.0.0.1:4001"; function App() { const [response, setResponse] = useState(""); useEf... 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-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-27 02:24:07
socket.io react
import React, { useState, useEffect } from "react"; import socketIOClient from "socket.io-client"; const ENDPOINT = "http://127.0.0.1:4001"; function App() { const [response, setResponse] = useState(""); useEf... Add solution -
Javascript 2021-10-06 04:34:06
passing event handler to useEffeect
const App =() => { const [userText, setUserText] = useState(""); useEffect(() => { const handleUserKeyPress = event => { const { key, keyCode } = event; if (keyCode === 32 || (keyCode >= 65 && keyCode &l... Add solution -
Javascript 2021-09-18 04:57:03
how to connect socket in react js
connect to the socket server on component mount with useEffect save each new incoming message in the component's state. function App() { const [response, setResponse] = useState(""); useEffect(() => { const socket = socketIOClient(E... Add solution -
Javascript 2021-09-14 08:01:03
controlled components reactjs interview questions
function FormValidation(props) { let [inputValue, setInputValue] = useState(""); let updateInput = e => { setInputValue(e.target.value); }; return ( <div> <form> <input type="text" value={input... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5