Skip to content

Default the child element of Localized to null #378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2019

Conversation

flut1
Copy link
Contributor

@flut1 flut1 commented Jun 20, 2019

If no child element is provided and <Localized /> tries to return the children as a fallback, undefined is returned. This causes a React error that is difficult to track down. Instead, default the child element to null, which is a valid return value for a React component.

Fixes #377

If no child element is provided and <Localized /> tries to return
the children as a fallback, undefined is returned from the
component. This causes a React error, which is difficult to
track down. Instead, default the child element to null, which is
a valid return value for a React component.
@stasm stasm merged commit 2b352f8 into projectfluent:master Jul 1, 2019
@stasm
Copy link
Contributor

stasm commented Jul 1, 2019

Thanks, @flut1. I'll publish a new version of fluent-react this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<Localized /> fallback case throws react error if no children are provided
2 participants