purescript-contrib / purescript-react

React Bindings for PureScript
MIT License
400 stars 65 forks source link

statelessComponent with displayName #156

Open anilanar opened 6 years ago

anilanar commented 6 years ago

As the title says. The implementation is simple:

exports.statelessComponent = function(displayName) { 
    return function(x) { 
        val y = function(props) { return x(props); };
        y.displayName = displayName;
        return y;
    };
};

Can name it statelessComponent' or something similar to avoid a breaking change.

natefaubion commented 6 years ago

You can already do this additional boxing with component. statelessComponent just coerces an existing function. It's just that PureScript has no semantics for adding a name to a function.