I'm new for SharePoint SPFx and React, got a question, the code generated by gulp below:
export default class HelloReactWebPart extends BaseClientSideWebPart<IHelloReactWebPartProps> {
public render(): void {
const element: React.ReactElement<IHelloReactProps> = React.createElement(
HelloReact,
{
description: this.properties.description
}
);
ReactDom.render(element, this.domElement);
}
Is there a way to create the element using JSX, not use React.ReactElement, like something below:
const element: React.ReactElement<IHelloReactProps> =
<HelloReact description={this.properties.description} />
Thanks!
createElement
. you can use the online babel repl to see babeljs.io/repl/… – azium