Skip to content

React - property key. Property not found in props #4202

Open
@karelbilek

Description

/* @flow */

import React from 'react';
type Props = {
    key: string; 
    foo: number;
}

class Inner extends React.PureComponent {
  props: Props;

  render() {
    return <div>
      {this.props.foo}
    </div>
  }
}

class Outer extends React.PureComponent {
  render() {
    return <div>
        <Inner 
          key={"some string"}
          foo={2}
    	></Inner>
    </div>
  }
}

The error:

10:   props: Props;
             ^ property `key`. Property not found in
22:         <Inner
             ^ props of React element `Inner`

Reproducible on flow.org/try .

"Fixed" by removing key: string from props (flow.org)

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions