Git Product home page Git Product logo

react-formik's Introduction

connect()

  1. connect() is a higher-order component (HoC)
  2. It is used internally to construct and

ErrorMessage

is a component that renders the error message of a given field if that field has been visited (i.e.touched[name] === true) (and there is an error message present). It expects that all error messages are stored for a given field as a string. Like , , and , lodash-like dot path and bracket syntax is supported.

Field

will automagically hook up inputs to Formik. It uses the name attribute to match up with Formik state. will default to an HTML element.

FieldArray

is a component that helps with common array/list manipulations. You pass it a name property with the path to the key within values that holds the relevant array. will then give you access to array helper methods via render props. For convenience, calling these methods will trigger validation and also manage touched for you.

Form

Form is a small wrapper around an HTML element that automatically hooks into Formik's handleSubmit and handleReset. All other props are passed directly through to the DOM node.

Formik

is a component that helps you with building forms. It uses a render props pattern made popular by libraries like React Motion and React Router.

useField()

useField is a custom React hook that will automagically help you hook up inputs to Formik. You can and should use it to build your own custom input primitives. There are 2 ways to use it.

useFormik()

useFormik() is a custom React hook that will return all Formik state and helpers directly. Despite its name, it is not meant for the majority of use cases. Internally, Formik uses useFormik to create the component (which renders a React Context Provider). If you are trying to access Formik state via context, use useFormikContext. Only use this hook if you are NOT using or withFormik.

** Be aware that , , , connect(), and will NOT work with useFormik() as they all require React Context.

useFormikContext()

useFormikContext() is a custom React hook that will return all Formik state and helpers via React Context.

withFormik()

Create a higher-order React component class that passes props and form handlers (the "FormikBag") into your component derived from supplied options.

react-formik's People

Contributors

omarfaruq947 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.