Skip to content

Commit c6bd549

Browse files
committed
Remove defaultProps from React package
React 18.3 added a deprecation warning for usage of defaultProps in functional components.
1 parent 805e1f8 commit c6bd549

3 files changed

Lines changed: 2 additions & 12 deletions

File tree

packages/react/src/components/LanguagePicker.jsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import useTX from '../hooks/useTX';
1010
*
1111
* - className: the CSS class to use on the <select> tag */
1212

13-
export default function LanguagePicker({ className }) {
13+
export default function LanguagePicker({ className = '' }) {
1414
const languages = useLanguages();
1515
const locale = useLocale();
1616
const tx = useTX();
@@ -31,7 +31,3 @@ export default function LanguagePicker({ className }) {
3131
LanguagePicker.propTypes = {
3232
className: PropTypes.string,
3333
};
34-
35-
LanguagePicker.defaultProps = {
36-
className: '',
37-
};

packages/react/src/components/T.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,4 @@ export default function T({ _str, ...props }) {
2525
return useT()(_str, props);
2626
}
2727

28-
T.defaultProps = {};
29-
3028
T.propTypes = { _str: PropTypes.string.isRequired };

packages/react/src/components/UT.jsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import useT from '../hooks/useT';
1818
* `div` or a `span`.
1919
* */
2020

21-
export default function UT({ _str, _inline, ...props }) {
21+
export default function UT({ _str, _inline = false, ...props }) {
2222
const translation = useT()(
2323
_str,
2424
{ _inline, _escapeVars: true, ...props },
@@ -28,10 +28,6 @@ export default function UT({ _str, _inline, ...props }) {
2828
return React.createElement(parent, parentProps);
2929
}
3030

31-
UT.defaultProps = {
32-
_inline: false,
33-
};
34-
3531
UT.propTypes = {
3632
_str: PropTypes.string.isRequired,
3733
_inline: PropTypes.bool,

0 commit comments

Comments
 (0)