Skip to content

v2.4.0

Compare
Choose a tag to compare
@fkling fkling released this 30 Oct 17:07
· 2249 commits to main since this release

New

Support for stateless/funtional components (React v0.14)

Since React v0.14, components can be defined as simple functions:

function SimpleComponent(props) {
    return <div>{this.props.soSimple}</div>
}

Thanks to @iamdustan, react-docgen is now able to detect these components as well. The findExportedComponentDefinition and findAllComponentDefinitions have been updated accordingly.

A function is considered to be a stateless React component if we can determine that it returns a JSX element or the result of a React.createElement call. As always, there are limits to what can be achieved with static analysis, so it might not detect every possible case (but maybe your component is too complex then anways? ;) ).