// @flow import React, { createContext, Component, Fragment } from 'react'; import styles from './EditableProps.css'; type StatefulFunctionProps = {| count: number |}; function StatefulFunction({ count }: StatefulFunctionProps) { return
  • Count: {count}
  • ; } const BoolContext = createContext(true); // $FlowFixMe Flow does not yet know about Context.displayName BoolContext.displayName = 'BoolContext'; type Props = {| name: string, toggle: boolean |}; type State = {| cities: Array, state: string |}; class StatefulClass extends Component { static contextType = BoolContext; state: State = { cities: ['San Francisco', 'San Jose'], state: 'California', }; handleChange = ({ target }) => this.setState({ state: target.value, }); render() { return (
  • Name: {this.props.name}
  • Toggle: {this.props.toggle ? 'true' : 'false'}
  • State:
  • Cities: {this.state.cities.join(', ')}
  • Context: {this.context ? 'true' : 'false'}
  • ); } } export default function EditableProps() { return (
    Editable props
    ); }