You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use react-redux-form with the UI components to render a form.
This code renders fine:
import { Control, Form, actions, } from 'react-redux-form'
import { Button as UIButton, Form as UIForm, } from 'semantic-ui-react'
...
class NewForm extends Component {
...
render() {
return (
<UIForm
as={Form}
model="forms.foo"
onSubmit={(foo) => this.handleSubmit(foo)}>
<Control.text
label="Description"
model="forms.foo.name" />
<UIForm.Button
type="submit">
Submit
</UIForm.Button>
</UIForm>
)
}
As you can see, the Form and Button components from Semantic are composed with react-redux-form's components. Everything works, including the onSubmit button.
However, replacing the Control.text element with the following:
Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.
This is weird since composition is working with some of the components, but not others.
The relevant documentation for react-redux-form can be found here.
FWIW, I've tried many combinations of different semantic props such as control, type, etc., and none of them seem to work.
The error is a React error indicating that Control.text is undefined. When you render as another component, we simply return that component in the render function.
In this case I'd suggest not using the shorthand Form.Input and instead use a regular Form.Field with your control inside of it.
I'm trying to use react-redux-form with the UI components to render a form.
This code renders fine:
As you can see, the Form and Button components from Semantic are composed with react-redux-form's components. Everything works, including the onSubmit button.
However, replacing the Control.text element with the following:
Causes the following error:
This is weird since composition is working with some of the components, but not others.
The relevant documentation for react-redux-form can be found here.
FWIW, I've tried many combinations of different semantic props such as control, type, etc., and none of them seem to work.
Lastly, here is everything I'm using:
The text was updated successfully, but these errors were encountered: