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.

Translate returning invalid value

See original GitHub issue

After updating to the latest version and switching to <Translate> from localize(), the following error logs to the console and the app doesn’t render at all: Invariant Violation: Translate.render(): A valid React element (or null) must be returned. It happens when using <Translate> with the id property, but if I supply it a render prop function, everything works well. The code is pretty simple:

const Introduction = () => {
  return (
    <section className={style.Introduction}>
      <article className={style.About}>
        <Translate id="introduction" />
      </article>
    </section>
  );
};

export default Introduction;

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
tariellaeliuscommented, Apr 12, 2018

Great! I’m glad I was able to help.

1reaction
ryandrewjohnsoncommented, Apr 11, 2018

I have confirmed that the issue is due to React 15 not supporting fragments and strings.

This was never an issue with the original translate function because that was always used in an expression, and it was ok to use text fragments not wrapped in elements. Where as the new Translate component will require wrapping text elements to render in react v15.

I’m most likely going to update the package.json peerDependency for react to 16.x.x, and then update the docs to include the workarounds if they want to use <Translate /> in older versions of React.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid value (400) using google translate api - Stack Overflow
This error is encounterd when the target language code is invalid. By invalid means its not in the list of languages supported by...
Read more >
The method 'Translate' has an invalid value for pa...
Translate failed Hi guys, I've been trying to figure out how to fix this error. When I test it on my desktop this...
Read more >
invalid value - Spanish translation - Linguee
Many translated example sentences containing "invalid value" – Spanish-English dictionary and search engine for Spanish translations.
Read more >
TranslateText - Amazon Translate API Reference
If you specify auto , you must send the TranslateText request in a region that supports Amazon Comprehend. Otherwise, the request returns an...
Read more >
SQLJ Error Messages - Oracle Help Center
Cause: The Oracle customizer translated a SQL operation into an ... Cause: User tries to retrieve a return value from a stored procedure...
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