Skip to content

Instantly share code, notes, and snippets.

@julianwachholz
Created August 27, 2019 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julianwachholz/a8cdd31ecf40c2008b5be7cb8f836fcf to your computer and use it in GitHub Desktop.
Save julianwachholz/a8cdd31ecf40c2008b5be7cb8f836fcf to your computer and use it in GitHub Desktop.
const MyForm: React.FC<any> = observer(({match, store}) => {
const obj = store.get(match.params.id);
if (obj === null) {
return <MyLoadingForm />;
}
// Invariant violation: Rendered more hooks than during the previous render.
const [data, setData] = useState(obj.data);
return <MyLoadedForm data={data} onSubmit={setData} />
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment