With ES6, it is possible to represent a React Component as a function.
So, the following component
class MyComponent extends React.Component {
render() {
<div>Hi</div>
}
}
could also be represented as such
const MyComponent = (props) => (
<div>Hi</div>
)
My question is whether the functional representation also allows for static properties. So, I'm wondering whether it is possible to represent the following component somehow as a function as well:
class MyComponentWithStaticProperty extends React.Component {
static myProperty = {'hello': 'world'}
render() {
<div>Hi</div>
}
}
const MyComponent = (props) => (
<div>Hi</div>
)
MyComponent.myProperty = {'hello': 'world'};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With