flipbyte / formik-json-schema

Easily create react forms using JSON / Javascript Object
MIT License
151 stars 40 forks source link

Render issue #21

Closed msimonc closed 5 years ago

msimonc commented 5 years ago

A basic form renders from this.state,

the api call returns with data and Json is constructed and saved to this.state

The component renders again, but the new form isn't displayed until I click on the (still displayed) basic form.

What do I do to trigger a re-render?

easeq commented 5 years ago

I am not sure I understand the issue. Can you show me the code?

msimonc commented 5 years ago

Sorry slow to reply, busy at work! It works if I do: render() { if (!this.state.dataHasLoaded) { return null; }... Seems your library only renders the first time my render renders it.

easeq commented 5 years ago

You can set the values using the initialValues prop and if you need to change the values multiple times then you can use enableReinitialize prop provided by formik.

If this doesn't work, please upload your component code, so that I can check what's wrong.