Skip to content

Commit 9d49e48

Browse files
committed
Simplify getString in withLocalization
1 parent f38f5e2 commit 9d49e48

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

fluent-react/src/with_localization.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ export default function withLocalization(Inner) {
66
const l10n = useContext(FluentContext);
77
return createElement(
88
Inner,
9-
// getString needs to be re-bound on updates to trigger a re-render
109
{
11-
getString: (id, args, fallback) => (
12-
l10n
13-
? l10n.getString(id, args, fallback)
14-
: fallback || id
15-
),
10+
// getString needs to be re-bound to trigger a re-render of Inner
11+
getString: (id, args, fallback) => l10n.getString(id, args, fallback),
1612
...props
1713
},
1814
);

0 commit comments

Comments
 (0)