This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react' | |
/** | |
* @helpers | |
*/ | |
const isValidText = (str) => { | |
return /^[a-zA-Z\s]+$/.test(str) | |
} | |
const isValidEmail = (str) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Form, FormGroup, Button } from "react-bootstrap"; | |
import formData from "./formData"; | |
import useForm from "./useForm"; | |
const SomeComponent = () => { | |
const { fields, setFields, handleSubmit, success } = useForm(formData); | |
return ( | |
<div css={CSS}> | |
<Form onSubmit={handleSubmit}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
const useForm = (formData) => { | |
const [fields, setFieldsState] = useState(formData.fields); | |
const [errors, setErrors] = useState({}) | |
const [success, setSuccess] = useState(false) | |
const setFields = (e) => { | |
const name = e.target.getAttribute("name"); | |
const value = e.target.value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Form, FormGroup } from "react-bootstrap"; | |
import formData from "./formData"; | |
import useForm from "./useForm"; | |
const SomeComponent = () => { | |
const { fields, setFields } = useForm(formData); | |
return ( | |
<div css={CSS}> | |
<Form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
const useForm = (formData) => { | |
const [fields, setFieldsState] = useState(formData.fields); | |
const setFields = (e) => { | |
const name = e.target.getAttribute("name"); | |
const value = e.target.value; | |
setFieldsState((prev) => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Form, FormGroup } from "react-bootstrap"; | |
import formData from "./formData"; | |
import useForm from "./useForm"; | |
const SomeComponent = () => { | |
const { fields } = useForm(formData); | |
return ( | |
<div css={CSS}> | |
<Form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Form } from 'react-bootstrap' | |
import formData from './formData' | |
import useForm from './useForm' | |
const SomeComponent = () => { | |
const { fields } = useForm(formData) | |
return ( | |
<div css={CSS}> | |
<Form>{/* */}</Form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react' | |
const useForm = (formData) => { | |
const [fields, setFieldsState] = useState(formData.fields) | |
return { fields } | |
} | |
export default useForm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
const useForm = () => { | |
return {} | |
} | |
export default useForm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Form } from 'react-bootstrap' | |
import formData from './formData' | |
const SomeComponent = () => { | |
return ( | |
<div css={CSS}> | |
<Form>{/* */}</Form> | |
</div> | |
) | |
} |