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.

Issue rendering TextField with helperText

See original GitHub issue

When I try to render TextField inside Autocomplete component I am getting an error:

Failed prop type: Invalid prop helperText supplied to ForwardRef(TextField), expected a ReactNode.

Here is a code snippet I am trying to render inside AutoComplete component: renderInput={(params) => ( <Field {...params} component={TextField} error={ touched['template'] && !!errors['template'] } helperText={errors['template']} variant="outlined" size="small" fullWidth /> )}

This started when I upgraded from 3.0.0 alpha 0 to 3.0.0. I am using formik-material-ui with formik 2.2.0. I have upgraded packages one by one and it came to formik-material-ui package that is causing the issue. If I use component={TextField} directly from material-ui everything works.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
itsmylifecommented, Nov 21, 2021

When I try to render TextField inside Autocomplete component I am getting an error:

Failed prop type: Invalid prop helperText supplied to ForwardRef(TextField), expected a ReactNode.

Here is a code snippet I am trying to render inside AutoComplete component: renderInput={(params) => ( <Field {...params} component={TextField} error={ touched['template'] && !!errors['template'] } helperText={errors['template']} variant="outlined" size="small" fullWidth /> )}

This started when I upgraded from 3.0.0 alpha 0 to 3.0.0. I am using formik-material-ui with formik 2.2.0. I have upgraded packages one by one and it came to formik-material-ui package that is causing the issue. If I use component={TextField} directly from material-ui everything works.

For the future developers:

it is happening because this helperText={errors['template']} is being used wrong. errors['template'] returns an object. It is react-hook-form error format. See the object https://react-hook-form.com/ts#FieldError So the solution is using it this way: helperText={errors['template']?.message}

Happy hacking.

0reactions
cliedemancommented, Nov 2, 2021

I am going to close this. but will happily take a look if anyway can create a codesandbox with the issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue rendering TextField with helperText #221 - GitHub
When I try to render TextField inside Autocomplete component I am getting an error: Failed prop type: Invalid prop helperText supplied to ...
Read more >
Adding ErrorText to material-ui Textfield moves other elements
The state.messages.emailMessage is initially set to null and so TextField does not have the extra space for the message when the input is...
Read more >
Issue rendering TextField with helperText - Bountysource
When I try to render TextField inside Autocomplete component I am getting an error: Failed prop type: Invalid prop helperText supplied to ...
Read more >
FormHelperText API - Material UI - MUI
API reference docs for the React FormHelperText component. Learn about the props, CSS, and other APIs of this exported module.
Read more >
React MUI TextField API - GeeksforGeeks
helperText : It is the helper text of the TextField. id: It is the id of the input TextField used for further processing....
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