Skip to content

Incorrect component name when using JSX and browserify #1751

Closed
@slorber

Description

@slorber

This is not a big deal, but in some Browserify cases the React component name is not correctly inferred from the variable name it is assigned, like it is normally the case during JSX transformation.

This works fine:

var Footer = React.createClass({
    ...
});
module.exports = Footer;

And produce error messages like: Warning: Required prop "appState" was not specified in "Footer". In this error message, the component name Footer was correctly inferred.

Now with another kind of node module declaration:

module.exports = React.createClass({
    ...
});

This does not work: Warning: Required prop "appState" was not specified in "exports"

This is quite annoying because it's then not so easy to know in which component we didn't inject the required props, and I guess some other usecases.

In case the React class is assigned to module.exports, I guess the component name should rather be the filename.

Don't know if it's a bug or a feature request, just wanted to mention that

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions