You can use Flow types instead of React PropTypes, but your suggested syntax is not the usual way to do this. See Flow docs (scroll down for ES6 syntax):
class Button extends React.Component { props: { title: string, visited: boolean, onClick: () => void, }; state: { display: 'static' | 'hover' | 'active'; }; static defaultProps = { visited: false, }; constructor(props) { super(props); this.state = { display: 'static', }; } render() { let className = 'button ' + this.state.display; if (this.props.visited) {
The only thing you cannot do with the types of streams you can use with PropTypes is defining custom validators (for example, to check if it is a valid email address).
I have more Examples of thread reactions on github , but I have not tested them with thread v0.22, but only v0.21. They may need minor adjustments.
source share