I try React and react-typist.
I have some problem. Then I pass a closure that change the state, to "onTypingDone" and called it, but not working correctly. I think that because Typist may not re-render inner components. For example, the following code. The following code does not work well.
How can I works correctly?
import * as React from 'react';
import Typist from 'react-typist';
export interface Props {}
export interface State {
className: string
}
export MyComponents extends React.Component<Props, State> {
constructor(props: Props)
{
super(props);
this.state = { className: "before" };
}
switch() {
this.setState({ className: "after" });
}
render()
{
<Typist onTypingDone={this.switch.bind(this)}>
<div className={this.state.className}>
<p>Hello.</p>
</div>
</Typist>
}
}