Closed payner35 closed 8 years ago
Probably not a direct Mantra question but...
Im trying to set up a simple HOC.
import React from 'react'; var CoreItem = Component => class extends React.component { constructor(props){ super(props); this.doSomething = this.doSomething.bind(this); } doSomeThing(){ console.log("doing something"); } render(){ return ( <Component doSomething = {this.doSomething} {... this.state} {... this.props}> </Component> ); } }; export default CoreItem;
and then call it like so...
import React from 'react'; import CoreItem from '/client/modules/cms/components/coreItem.jsx'; class EventAdmin extends React.Component { render(){ return( <div> <p>some text</p> </div> ); } } export default CoreItem(EventAdmin);
i'm getting an error.
Super expression must either be null or a function, not undefined
my bad....
class extends React.component vs class extends React.Component
class extends React.component
class extends React.Component
Probably not a direct Mantra question but...
Im trying to set up a simple HOC.
and then call it like so...
i'm getting an error.
Super expression must either be null or a function, not undefined