In a class component we can do this:
class Block extends React.Component {
public static customFunction1(){
return whatever;
}
public static customFunction2(){
return whatever;
}
render(){
return <Component />
}
}
So with the above component, we can directly use <Block /> wherever we want, and also utilize Block.customFunction() and the other one as well.
Now talking about Functional Component:
We tried doing
const Block = () => {
return <Component />
}
Block.customFunction1 = () => {
return whatever;
}
Block.customFunction2 = () => {
return whatever;
}
People are not recommending the above approach. I'm wondering what should be the approach which attaching methods to Functional Component?
Block({ canClick, canSpan }) {}?