v2.11.0
New
Detect exported components passed to HOCs
Until now, react-docgen didn’t find components that are passed to a higher order component (HOC):
function MyComponent() { /* ... */ }
export default hoc(MyComponent);
The workaround was to change the resolver to find all component definitions in the file, something that is not always desirable.
With #124, @rtsao extended the default resolver to be able to handle these cases.
Fixes
-
findAllExportedComponentDefinitions
can now be selected in the CLI.
(reported as issue #119) -
The static variable resolution process was fixed to consider assignments to variables. The following example didn’t work before and works now:
var Component; Component = React.createClass(...); module.exports = Component;
(reported as issue #58)
-
The display name handler now takes
displayName
getters in class definitions into account:class Component extends React.Component { static get displayName() { return 'Name'; } }
(reported as issue #61)
Internal improvements
To guard ourselves better against regressions, we are using jest’s snapshot tests to test component definitions that are reported as broken.