Pretty straight forward question. I come from a Qt/C++ background, and so I regard it as good practice to be explicit, thus
protected sanityCheck() : void { ... } // Smart and beautiful
protected sanityCheck() { ... } // Stupid and always wrong
Well, how do I be explicit with this:
protected toFoobar() : ?????
{
return ( <h1> foobar </h1> );
}
When I checked the documentation, it doesnt say anything. When I checked the typeof, it just said object.
Would this be the answer, or can I even be more specific?
Thanks.
The correct type would be JSX.Element
. that's what the JSX syntax always evaluates to. If you use React, JSX.Element
is just a type reference to React.Element<any, any>
.