StackOverflow - StackOverflow

"Objects are not valid as a React child" and linters

Functional components' first parameter should be props which is an object. then you access children or other props from it

export default function Label(props) {
  const { children, Cfor } = props;
  return (
    <label className="label mr-10" htmlFor={Cfor}>
      {children}
    </label>
  );
}

In addition, you cannot render an object directly. Instead you can render JSON.stringify(object)

Was this helpful?

Have a different question?

Can't find the answer you're looking for? Submit your own question to our community.

🛎️ Get Weekly OTA Fixes

New answers, vendor issues, and updates — straight to your inbox.