question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Warning: React does not recognize the `basePath` prop on a DOM element.

See original GitHub issue

Expected Behaviour: No warning of prop when Grid component is used inside SimpleForm component.

Current Behaviour: Getting below warning.

2.chunk.js:363015 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 div (created by ForwardRef(Grid))
    in ForwardRef(Grid) (created by WithStyles(ForwardRef(Grid)))
    in WithStyles(ForwardRef(Grid)) (at boqitemcreate.js:129)
    in div (created by FormInput)

Code:

<SimpleForm toolbar={<BoQCreateToolbar />} redirect={redirect}>
					<Grid container spacing={1} style={{ width: 'auto' }}>
						<Grid item xs={4}>

Environment

  • React-admin version: 3.1.1
  • Last version that did not exhibit the issue (if applicable):
  • React version: 16.12.0
  • Browser: Chrome/Opera
  • Stack trace (in case of a JS error):

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

16reactions
wayneblosscommented, Apr 1, 2021

Here’s an quick workaround that works by throwing away any props normally passed to an input:

export const NonInput = React.memo(function NonInput({ children }) {
  return children;
});

I use it in my <SimpleForm> to add notes and other non-input items to my forms:

      <TextField source="otherField" />
      <NonInput>
        <Typography color="error">
          Important note that is always visible and has it's own layout outside of any field!!
        </Typography>
      </NonInput>
6reactions
fzaninottocommented, Jan 3, 2020

SimpleForm expects Input or Field components as children (as explained in the documentation). So it’s normal that you see warnings if you pass anything else.

for your use case, you need a custom form component.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix the React does not recognize the `basePath ...
Warning : React does not recognize the basePath prop on a DOM element. If you intentionally want it to appear in the DOM...
Read more >
Unknown Prop Warning - React
The unknown-prop warning will fire if you attempt to render a DOM element with a prop that is not recognized by React as...
Read more >
Warning: React does not recognize the `isOpen` prop on a DOM
prop on a DOM element. i got solved this issue. just change tag to Navlink because ActiveClassName is just suported Navlink.
Read more >
React-admin - Upgrading to v4 - Marmelab
Keeping the basePath prop may result in unrecognized DOM props warnings, but your app will still work flawlessly even if you don't remove...
Read more >
warning: react does not recognize the prop on a dom element.
react does not recognize the basepath prop on a dom element. If you are trying to attach custom data to a standard DOM...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found