This file contains 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
function useFormik(props) { | |
// useState to keep the same observable around without recreating it on each render | |
const [formik] = React.useState(() => | |
mobx.observable({ | |
values: props.initialValues || {}, | |
touched: {} | |
}) | |
) | |
// just mutate state, this function itself can be considered an action+reducer |