Describe the problem
React version 18 doesn't use defaultProps anymore. It gave this warning every time I ran the app, and the logs are very long, it kind of annoying.

The root of the problem here: https://github.com/elastic/eui/blob/main/src/components/button/button.tsx#L135
Other components might also be affected.
Proposed solution
Before
EuiButton.defaultProps = {
size: 'm',
color: 'primary',
};
After
export const EuiButton = ({ size = 'm', color = 'primary' }) => {
// Your component logic here
return (
<EuiButton size={size} color={color}>
Button
</EuiButton>
);
};
You can set default values directly within the component function.
Describe the problem
React version 18 doesn't use

defaultPropsanymore. It gave this warning every time I ran the app, and the logs are very long, it kind of annoying.The root of the problem here: https://github.com/elastic/eui/blob/main/src/components/button/button.tsx#L135
Other components might also be affected.
Proposed solution
Before
After
You can set default values directly within the component function.