facebook/docusaurus · error · Error
The Docusaurus component only accept simple string values…
Error message
The Docusaurus <Interpolate> component only accept simple string values. Received: ${isValidElement(children) ? 'React element' : typeof children} What it means
<Interpolate> is a minimal string-templating component: its children must be a plain string containing {placeholder} markers, and values supplies the replacements. If children is not a string (a React element, number, etc.) it throws and reports the received type. To embed JSX, put the element into the values map and reference it by placeholder, not as children.
Solutions
- Keep children as a string template: <Interpolate values={{name}}>Hello, {"{name}"}</Interpolate>.
- Move JSX into the values object: values={{icon: <Icon/>}} and reference {icon} inside the string.
- If you need full rich-text translation, split into multiple <Translate> strings around the JSX.
Example fix
// before
<Interpolate values={{name}}>
Hello, <b>{name}</b>
</Interpolate>
// after
<Interpolate values={{name}}>
{"Hello, {name}"}
</Interpolate> Defensive patterns
Strategy: type-guard
Validate before calling
function assertInterpolateChildren(children: unknown) {
if (typeof children !== 'string') {
throw new Error(
'<Interpolate> children must be a string template',
);
}
} Type guard
const isInterpolatableString = (c: unknown): c is string => typeof c === 'string';
Prevention
- Reserve <Interpolate> children for string templates only; move JSX into values.
- If you need rich content, split into multiple strings around the JSX.
- Type your wrapper to require children: string.
When it happens
Trigger: Render <Interpolate values={{icon:<Icon/>}}>{<Icon/>} Hello</Interpolate>; pass a number or boolean as children; nest another component as children.
Common situations: Confusing Interpolate with a generic JSX wrapper; trying to translate rich content; refactoring a Translate/Interpolate call and dropping the template string.
Related errors
- The Docusaurus component only accept simple string values
- Docusaurus error: The
- Docusaurus translation declarations must have at least a…
- Bad usage of APITable component. It is probably that your…
- Can't find locale config for locale
AI-assisted analysis of facebook/docusaurus@3f483e80e3 (2026-08-12).
Data as JSON: /api/errors/843a2169cef417f1.
Report an issue: GitHub.
Appendix: source
Thrown at packages/docusaurus/src/client/exports/Interpolate.tsx:63
}
return seg;
});
if (segments.some((seg) => isValidElement(seg))) {
return segments
.map((seg, index) =>
isValidElement(seg) ? React.cloneElement(seg, {key: index}) : seg,
)
.filter((seg) => seg !== '');
}
return segments.join('');
}
export default function Interpolate<Str extends string>({
children,
values,
}: InterpolateProps<Str>): ReactNode {
if (typeof children !== 'string') {
throw new Error(
`The Docusaurus <Interpolate> component only accept simple string values. Received: ${
isValidElement(children) ? 'React element' : typeof children
}`,
);
}
return <>{interpolate(children, values)}</>;
}
View on GitHub (pinned to 3f483e80e3)