Using React with Flow

Other topics

Remarks:

Using Flow to check prop types of stateless functional components

type Props = {
  posts: Array<Article>,
  dispatch: Function,
  children: ReactElement
}

const AppContainer =
  ({ posts, dispatch, children }: Props) => (
    <div className="main-app">
      <Header {...{ posts, dispatch }} />
      {children}
    </div>
  )

Using Flow to check prop types

import React, { Component } from 'react';

type Props = {
  posts: Array<Article>,
  dispatch: Function,
  children: ReactElement
}

class Posts extends Component {
  props: Props;

  render () {
    // rest of the code goes here
  }
}

Contributors

Topic Id: 7918

Example Ids: 25692,26585

This site is not affiliated with any of the contributors.