Skip to content

Commit 6adc54b

Browse files
committed
Default the child element of Localized to null
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.
1 parent ab37e18 commit 6adc54b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fluent-react/src/localized.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default class Localized extends Component {
7979

8080
render() {
8181
const { l10n, parseMarkup } = this.context;
82-
const { id, attrs, children: elem } = this.props;
82+
const { id, attrs, children: elem = null } = this.props;
8383

8484
// Validate that the child element isn't an array
8585
if (Array.isArray(elem)) {

0 commit comments

Comments
 (0)