Hi Everybody,
I’m starting my first project with React. It seems that Uniform is the most used package to create forms, so I’m starting with that. However, I’ve run in to a problem.
I started the project using this boilerplate: https://github.com/onezoomin/meteor-react-semantic
And now I’m trying to add the form…
The file I call the form in is here: meteor-react-semantic/imports/ui/pages/
and the schema is here: meteor-react-semantic/imports/api/schema.js
But I do not think the position of the files is the problem?
The schema, however, I copied from the HowTo; that should be ok:
import {SimpleSchema} from 'meteor/aldeed:simple-schema';
export const PersonSchema = new SimpleSchema({
title: {
type: String,
},
authorName: {
type: String,
optional: true,
},
content: {
type: String,
min: 10
},
status: {
type: String,
allowedValues: ['draft', 'published'],
defaultValue: 'draft'
}
});
and I call it like this in meteor-react-semantic/imports/ui/pages/home.jsx:
import React from 'react';
import {Image, Grid, Segment, Menu, Modal, Header} from 'semantic-ui-react';
import {PersonSchema} from '/imports/api/schema';
import {AutoForm} from 'uniforms-semantic';
export default class Home extends React.Component {
render() {
return (
<AutoForm
schema={PersonSchema}
onSubmit={this.onSubmit}
/>
);
}
}
But I get this error:
The above error occurred in the <AutoValidatedQuickSemanticForm> component:
in AutoValidatedQuickSemanticForm (created by Home)
in Home (created by Route)
in Route
in Switch
in div
in Router (created by BrowserRouter)
in BrowserRouter
Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries. modules.js:18910:13
Error: Unrecognised schema: [object Object] modules.js:25105:15
Error: Unrecognised schema: [object Object] modules.js:25105:15
Which seems to me like it does not evaluate the object in schema.js correctly
Anyway: help!