Im using react native 0.48 and I was wondering if the following is possible.
So my intention is to make my code a little bit more reusable. I have 4 classes each of them have similar code within componentDidMount. They share similar code componentDidMount() but the rest of the code in the render method is a little different.
My idea was this to share code across classes:
class 1
componentDidMount(){
componentDidMountTemplate().bind(this);
}
where inside componentDidMountTemplate(which is a just an exported function), code that uses "this" keyword that should operate on objects in class 1, or basically any class that calls and binds this
however the line componentDidMountTemplate().bind(this); generates this error:
cannot call a class as a function
any solutions? ideas?