How to fix Functions are not valid as React children in React

ReactBEGINNERHIGHUpdated Dec 10, 2025· 103 views

This error occurs when you accidentally pass a function reference instead of calling it or rendering a component. React expects child elements to be renderable JSX elements, not function references.

Quick fix

Fixes Functions are not valid as React children

<div>{renderContent}</div>
  1. Check if you're calling the function
  2. Use JSX syntax for components
  3. Fix React Router element prop
  4. Review dynamic component rendering
react — error
<div>{renderContent}</div>
Functions are not valid as React children

What this error means

React treats JSX children as elements that should be renderable components, JSX elements, or valid React data types like strings, numbers, and arrays. When you pass a function reference directly, React doesn't know how to render it and throws this error. This typically happens in two scenarios: (1) you're returning a function reference instead of calling it with parentheses, or (2) you're using a component name without the JSX angle brackets.

Typical symptoms

  • Browser console shows 'Functions are not valid as a React child' warning
  • Child element fails to render on the page
  • Page displays nothing where the function was supposed to render
  • Error appears when using React Router with incorrect element syntax

Common causes

  1. Passing a function reference without calling it: {myFunction} instead of {myFunction()}
  2. Using a component name without JSX syntax: element={MyComponent} instead of element={<MyComponent />}
  3. Incorrect React Router v6 syntax with Route elements
  4. Accidentally returning a function definition instead of its result
  5. Passing a component as a string reference instead of as a JSX element

How to fix "Functions are not valid as React children"

1Check if you're calling the function

Look for curly braces in your JSX that contain a function name without parentheses.

Wrong:

jsx
<div>{renderContent}</div>

Correct:

jsx
<div>{renderContent()}</div>

Add parentheses () to call the function and return its JSX result.

2Use JSX syntax for components

When rendering a component, always use angle brackets to create a JSX element.

Wrong:

jsx
<div>{MyComponent}</div>

Correct:

jsx
<div><MyComponent /></div>

This tells React to instantiate the component and render it, rather than passing the function itself.

3Fix React Router element prop

In React Router v6, the element prop requires a JSX element, not a component reference.

Wrong:

jsx
<Route path="/about" element={About} />

Correct:

jsx
<Route path="/about" element={<About />} />

Wrap your component in JSX syntax to create an element.

4Review dynamic component rendering

If you're rendering components dynamically, ensure you're using JSX syntax:

Wrong:

jsx
const components = { Button: MyButton };
return <div>{components.Button}</div>;

Correct:

jsx
const Component = components.Button;
return <div><Component /></div>;

Assign the component to a variable, then use it with angle brackets.

Advanced notes

Render Props Pattern: If you intentionally want to pass a function as children (a valid advanced pattern), use the render props or function-as-children pattern. In this case, you call the function inside your component: this.props.children(data) instead of rendering it directly.

Function vs Component: Remember that in React, a component is a function that returns JSX. The difference is in how you use it: myFunction is a function reference, myFunction() executes it, and <MyFunction /> is JSX that React uses to create an instance of the component.

Frequently asked questions

What does "Functions are not valid as React children" mean?
React treats JSX children as elements that should be renderable components, JSX elements, or valid React data types like strings, numbers, and arrays. When you pass a function reference directly, React doesn't know how to render it and throws this error. This typically happens in two scenarios: (1) you're returning a function reference instead of calling it with parentheses, or (2) you're using a component name without the JSX angle brackets.
How do I fix "Functions are not valid as React children"?
This error occurs when you accidentally pass a function reference instead of calling it or rendering a component. React expects child elements to be renderable JSX elements, not function references.
What causes "Functions are not valid as React children"?
Passing a function reference without calling it: {myFunction} instead of {myFunction()} Using a component name without JSX syntax: element={MyComponent} instead of element={<MyComponent />} Incorrect React Router v6 syntax with Route elements
Is the "Functions are not valid as React children" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading