Skip to content

React generator error: Field missing from import #243

@walva

Description

@walva

API Platform Client Generator affected: >= 0.5.0

Description
In a generated react client the following error occurs: Failed to compile 'Field' is not defined react/jsx-no-undef.
It occurs in ./src/component/{entity name}/Form.js for each Field.
It worked after I changed client/src/components/{entity name}/Form.js line 2
from:
import { reduxForm } from 'redux-form';
to:
import { Field, reduxForm } from 'redux-form';
Probably caused by the change in templates/react/components/foo/Form.js in commit:
"fix tests" committed Oct 24, 2020
7d740dc#diff-929e3b2ef753bdeb716342d2ce2632ab9094af8e6694bc8f9382c173466514c9
How to reproduce

Possible Solution
Revert the line 2 change in templates/react/components/foo/Form.js; by importing Field.

import { Field, reduxForm } from 'redux-form';

Additional Context
image

Many thanks to @metaclass-nl who helped me a lot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions