How to use Growl component in typescript
Posted: 23 May 2019, 00:31
Hi,
Please suggest how to use the Growl component in typescript project.
Below is my code from App.tsx.
import { Growl } from 'primereact/growl';
type IProps = {};
type IState = {
currentUser: {
email: string;
};
};
class App extends React.Component<IProps, IState> {
private growl: Growl;
constructor(props: IProps) {
super(props);
this.state = {
currentUser: {
email: 'user@xxx.com'
}
};
this.growl = React.createRef<Growl>();
}
public componentDidMount() {
this.growl.show({
severity: 'success',
summary: 'Success Message',
detail: 'Order submitted'
});
}
public render() {
return (
<div>
<Growl ref={el => (this.growl = el)} />
</div>
);
}
}
export default App;
Please suggest how to use the Growl component in typescript project.
Below is my code from App.tsx.
import { Growl } from 'primereact/growl';
type IProps = {};
type IState = {
currentUser: {
email: string;
};
};
class App extends React.Component<IProps, IState> {
private growl: Growl;
constructor(props: IProps) {
super(props);
this.state = {
currentUser: {
email: 'user@xxx.com'
}
};
this.growl = React.createRef<Growl>();
}
public componentDidMount() {
this.growl.show({
severity: 'success',
summary: 'Success Message',
detail: 'Order submitted'
});
}
public render() {
return (
<div>
<Growl ref={el => (this.growl = el)} />
</div>
);
}
}
export default App;