Improving Gatsby rendering solution
Now the form will be prerendered
This commit is contained in:
parent
9a4f669c2d
commit
1f5da0c690
@ -146,7 +146,7 @@ class App extends React.PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return <AppContext.Provider value={ context }>
|
return <AppContext.Provider value={ context }>
|
||||||
{ syntax && <Form /> }
|
<Form />
|
||||||
|
|
||||||
<Loader />
|
<Loader />
|
||||||
|
|
||||||
|
@ -20,6 +20,15 @@ class Form extends React.PureComponent {
|
|||||||
syntax: this.context.syntax
|
syntax: this.context.syntax
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidUpdate() {
|
||||||
|
if (this.state.expr === undefined && this.state.syntax === undefined) {
|
||||||
|
this.setState({
|
||||||
|
syntax: this.context.syntax,
|
||||||
|
expr: this.context.expr
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleSubmit = event => {
|
handleSubmit = event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user