## Sinon Stub method which invoke from method after click ``` export default class Class extends React.Component { constructor(props) { super(props); this.state = { typeOfNodes: 0, lifetimeInYears: 1, }; // this.toggleTwo = this.toggleTwo.bind(this); } async toggleTwo(event) { await this.setState({ typeOfNodes: event, }); // invoke another function this.getPrice(event); } async getPrice(event) { let lifetimeInYears = event ? event['value'] : this.state.lifetimeInYears; let lifetimeInSeconds = parseInt(lifetimeInYears) * 366 * 86400; let priceInWei = someLibMethod({ indexOfType: parseInt(this.state.typeOfNodes), lifetime: lifetimeInSeconds }); let res = await this.fromWei(priceInWei); this.setState({ deposit: res, totalDeposit: res, totalDepositInWei: priceInWei, lifetimeInSeconds: lifetimeInSeconds, lifetimeInYears: lifetimeInYears, selectedOption: event, }); console.log('price of schain', res); } render() { return (
Tiny