Hi I'm trying to make a minimal version of this work. schema loads OK from the server and I get a form rendered but clicking the submit button doesn't work. What am I missing?
import "semantic-ui-css/semantic.min.css";
import React from 'react';
import ApolloClient from "apollo-client";
import { InMemoryCache } from "apollo-cache-inmemory";
import { createHttpLink } from "apollo-link-http";
import { Frontier } from "frontier-forms";
import { Form, Button } from "semantic-ui-react";
import gql from "graphql-tag";
let backend = "http://localhost:4000/graphql";
console.log('using backend', backend);
const client = new ApolloClient({
link: createHttpLink({
// read-only endpoint
uri: backend
}),
cache: new InMemoryCache()
});
function ApplicationForm({ name, oga_no }) {
const mutation = gqlmutation($a:String!, $n:Int) { addBoat(name:$a, oga_no:$n) { name oga_no id } }
;
return (
<div style={{ paddingLeft: "50px", paddingTop: "50px" }}>
<div style={{ width: "245px" }}>
Add a Boat
<Frontier
initialValues={{ name: "a", oga_no: "1" }}
client={client}
mutation={mutation}
>
{({ state, modifiers }) => {
return (
<Form onSubmit={() => modifiers.save()}>
<Form.Input label="name" onChange={modifiers.name.change}/>
<Form.Input label="number" onChange={modifiers.oga_no.change}/>
Submit
);
}}
);
}
export default ApplicationForm;
=============
TypeError: modifiers.save is not a function
onSubmit
src/ApplicationForm.js:48
45 | >
46 | {({ state, modifiers }) => {
47 | return (
48 | <Form onSubmit={() => modifiers.save()}>
| ^ 49 | <Form.Input label="name" onChange={modifiers.name.change}/>
50 | <Form.Input label="number" onChange={modifiers.oga_no.change}/>
51 | Submit
View compiled
▼ 27 stack frames were expanded.
apply
node_modules/lodash/_apply.js:15
baseInvoke
node_modules/lodash/_baseInvoke.js:21
apply
node_modules/lodash/_apply.js:16
(anonymous function)
node_modules/lodash/_overRest.js:32
(anonymous function)
node_modules/semantic-ui-react/dist/es/collections/Form/Form.js:64
HTMLUnknownElement.callCallback
node_modules/react-dom/cjs/react-dom.development.js:336
invokeGuardedCallbackDev
node_modules/react-dom/cjs/react-dom.development.js:385
invokeGuardedCallback
node_modules/react-dom/cjs/react-dom.development.js:440
invokeGuardedCallbackAndCatchFirstError
node_modules/react-dom/cjs/react-dom.development.js:454
executeDispatch
node_modules/react-dom/cjs/react-dom.development.js:584
executeDispatchesInOrder
node_modules/react-dom/cjs/react-dom.development.js:609
executeDispatchesAndRelease
node_modules/react-dom/cjs/react-dom.development.js:713
executeDispatchesAndReleaseTopLevel
node_modules/react-dom/cjs/react-dom.development.js:722
forEachAccumulated
node_modules/react-dom/cjs/react-dom.development.js:694
runEventsInBatch
node_modules/react-dom/cjs/react-dom.development.js:739
runExtractedPluginEventsInBatch
node_modules/react-dom/cjs/react-dom.development.js:880
handleTopLevel
node_modules/react-dom/cjs/react-dom.development.js:5803
batchedEventUpdates$1
node_modules/react-dom/cjs/react-dom.development.js:24401
batchedEventUpdates
node_modules/react-dom/cjs/react-dom.development.js:1415
dispatchEventForPluginEventSystem
node_modules/react-dom/cjs/react-dom.development.js:5894
attemptToDispatchEvent
node_modules/react-dom/cjs/react-dom.development.js:6010
dispatchEvent
node_modules/react-dom/cjs/react-dom.development.js:5914
unstable_runWithPriority
node_modules/scheduler/cjs/scheduler.development.js:697
runWithPriority$2
node_modules/react-dom/cjs/react-dom.development.js:12149
discreteUpdates$1
node_modules/react-dom/cjs/react-dom.development.js:24417
discreteUpdates
node_modules/react-dom/cjs/react-dom.development.js:1438
dispatchDiscreteEvent
node_modules/react-dom/cjs/react-dom.development.js:5881
▲ 27 stack frames were expanded.
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this erro