How to use react component in spfx ?
1.
Add React Webpart
2.
Once your webpart
is ready then open .tsx file from component folderand Import react component reference in your webpart
import {Label} from
'office-ui-fabric-react';
3.
We will add a
Label component in render method to show a message on webpart.
public render():
React.ReactElement<IReactDemoProps> {
return (
<div className={ styles.reactDemo }>
<div className={ styles.container }>
<div className={ styles.row }>
<div className={ styles.column
}>
<Label
className={styles.title}>Welcome to react component</Label>
</div>
</div>
</div>
</div>
);
}
4.
Result :รจ
No comments:
Post a Comment