What do you want to save?
Add Code snippet
New code examples
-
Other 2022-03-16 22:00:14
setState of one element of an object of states
function LoginForm() { const [form, setState] = useState({ username: '', password: '' }); const printValues = e => { e.preventDefault(); console.log(form.username, form.password); }; const updateField = e => { setStat... Add solution -
Other 2022-03-16 10:05:01
bind input value to useState
export function NameForm(props) { const { value:firstName, bind:bindFirstName, reset:resetFirstName } = useInput(''); const { value:lastName, bind:bindLastName, reset:resetLastName } = useInput(''); const handleSubmit = (evt) => { evt.pr... Add solution -
Javascript 2022-02-02 02:50:20
How to Submit Forms and Save Data with React.js
class UserForm extends React.Component { constructor(props) { super(props); this.state = {username: ''}; this.handleChange = this.handleChange.bind(this); thi... Add solution -
Javascript 2022-02-01 06:06:18
how to get a value into a react component
class NameForm extends React.Component { constructor(props) { super(props); this.handleSubmit = this.handleSubmit.bind(this); this.input = React.createRef(); } handleSubmit(event) { alert('A name was submitted: ' + this.input.curren... Add solution -
Javascript 2022-01-22 04:41:09
react-hook-form
import React from 'react'; import { useForm } from 'react-hook-form'; function App() { const { register, handleSubmit, errors } = useForm(); // initialize the hook const onSubmit = (data) => { console.log(data); }; return ( <form o... Add solution -
Javascript 2021-11-22 00:52:15
formiks basic tutorial
import React from 'react'; import { useFormik } from 'formik'; const SignupForm = () => { // Pass the useFormik() hook initial form values and a submit function that will // be called when the form is submitted const formik = useFormik({ ini... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5