Skip to content

Instantly share code, notes, and snippets.

@sahilrajput03
Last active September 17, 2020 17:53
Show Gist options
  • Save sahilrajput03/66d149afe07be89e651696d001c4f56a to your computer and use it in GitHub Desktop.
Save sahilrajput03/66d149afe07be89e651696d001c4f56a to your computer and use it in GitHub Desktop.
Dealing curiosity with <Formik> {<ComponentHere/> /* is bad thing */}.md

CHECK IF WE GET AUTOTYPING, AUTOCOMPLETE WHEN WE PASS FORM COMPONENT EXPLICITLY TO <Formik> Component

const MyFormComponent = () => (<Form> </Form>)

<Formik> {MyFormComponent} </Formik>`

instead of passing inplicityly passing component as

const FomikComponent = () => (<Formik>{() => 	(<Form> and other bullshit.. <<<here..refer formik site...>>>)})

Conclusion from observations

No we don't get typings from typescript then, we must enclose the component inside component like naked, coz tsc manages all nested typecheckings itself though, and manages all the typing for props, thus enables us to manage live documentation inside IDE, so its best use of tsc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment