The patter of calling the methods in SPFx React life cycle are as below Constructor method > ComponetWillMount > render method > ComponentDidMount > any custom methods on either button clicks > ComponentUnmount In React, we just observe render method. But there are other methods which we can go through. Step 1: First, I am creating a blank webpart with react framework. Step 2: Now in tsx file, we are going to create an interface. We are not using the interface which has in components folder .ts file for interface. export interface IReactLifeCycleWPState{ stageTitle: string } Now, we need to extend in the .tsx file HTML part with our new interface we created. We are adding IReactLifeCycleWPState Interface to our default export class as below. export default class Reactlifecyclewebpart extends React.Component<IReactlifecyclewebpartProps, IReactLifeCycleWPState > { Now, we need a constructor in .tsx file. We are using a parameterize...
Comments
Post a Comment