i'm writing react component using es6 classes, , 1 of props can either string or <div>.
how tell flow <div> acceptable?
currently:
import react 'react' type props = { title: string, content: string | // <- or div }; export class thiscomponent extends react.component { // ...
you can use global type react$element
type props = { title: string, content: string | react$element<any> }; afaik can't restrict divs though
<thiscomponent title="mytitle" content={<div/>} /> // <= ok <thiscomponent title="mytitle" content={<a/>} /> // <= ok
Comments
Post a Comment