React-admin: React does not recognize the `basePath` prop on a DOM element

Created on 22 Nov 2019  路  6Comments  路  Source: marmelab/react-admin

Simple form generates "React does not recognize the basePath prop on a DOM element"

Applying next change in node_modules (: ) fixes the error

export var FormInput = function (_a) {
   // appending "basePath" fixes error
    var classes = _a.classes, input = _a.input, rest = __rest(_a, ["classes", "input", "basePath"]);
    console.log(rest)
    var _b, _c;
    return input ? (React.createElement("div", { className: classnames('ra-input', "ra-input-" + input.props.source, input.props.formClassName) }, input.props.addLabel ? (React.createElement(Labeled, __assign({ id: input.props.id || input.props.source }, input.props, sanitizeRestProps(rest)), React.cloneElement(input, __assign({ className: classnames((_b = {},
            _b[classes.input] = !input.props.fullWidth,
            _b), input.props.className), id: input.props.id || input.props.source }, rest)))) : (React.cloneElement(input, __assign({ className: classnames((_c = {},
            _c[classes.input] = !input.props.fullWidth,
            _c), input.props.className), id: input.props.id || input.props.source }, rest))))) : null;
};

Environment

  • React-admin version:
    "ra-core" "2.8.6",
  • React version:
    "react" "16.8.6",
  • Browser: Chrome
  • Stack trace (in case of a JS error):
index.js:1437 Warning: React does not recognize the `basePath` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `basepath` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
    in span (at form/index.js:73)
    in div (created by FormInput)
    in FormInput (created by WithStyles(FormInput))
    in WithStyles(FormInput) (created by FormTab)
    in span (created by FormTab)
    in FormTab (created by Context.Consumer)
    in translate(FormTab) (at form/index.js:29)
    in Route (created by TabbedForm)
    in div (created by CardContent)
    in CardContent (created by WithStyles(CardContent))
    in WithStyles(CardContent) (created by CardContentInner)
    in CardContentInner (created by WithStyles(CardContentInner))
    in WithStyles(CardContentInner) (created by TabbedForm)
    in form (created by TabbedForm)
    in TabbedForm (created by WithStyles(TabbedForm))
    in WithStyles(TabbedForm) (created by Form(WithStyles(TabbedForm)))
    in Form(WithStyles(TabbedForm)) (created by Connect(Form(WithStyles(TabbedForm))))
    in Connect(Form(WithStyles(TabbedForm))) (created by ReduxForm)
    in ReduxForm (created by Context.Consumer)
    in translate(ReduxForm) (created by Connect(translate(ReduxForm)))
    in Connect(translate(ReduxForm)) (created by Route)
    in Route (created by withRouter(Connect(translate(ReduxForm))))
    in withRouter(Connect(translate(ReduxForm))) (at form/index.js:28)

the value of basePath is the name of my resource

needs more info

Most helpful comment

There is no documentation on this subject yet. You'll have to read the code of the SimpleFormIterator

All 6 comments

Can't reproduce that on the simple example. Please follow the issue template and provide a way to reproduce it.

Also, this may have been fixed in subsequent minor patches. Try upgrading to 2.9.9 first.

No news for some time, closing.

Hello @fzaninotto
I reproduce the issue on my side using an expansion MUI component here is a screenshot and the link to the codesandbox to reproduce
image

  • https://codesandbox.io/s/still-browser-61lj3
  • Reproduction steps :

    1. Click on "miscellaneous" tab

    2. Click on the expansion Menu "Advanced", the error appears in the console

      but I'm not convinced that the issue is comming from react-admin or perhaps any component child of an iterator should be sanetized

The SimpleFormIterator only accepts Input elements as children. For your use case, you must create a new form iterator.

The SimpleFormIterator only accepts Input elements as children. For your use case, you must create a new form iterator.

@fzaninotto Can you please point to some docs which elaborate how to do that?

There is no documentation on this subject yet. You'll have to read the code of the SimpleFormIterator

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phacks picture phacks  路  3Comments

ilaif picture ilaif  路  3Comments

kopax picture kopax  路  3Comments

yangjiamu picture yangjiamu  路  3Comments

kikill95 picture kikill95  路  3Comments