Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid to embed "mergeProps" on every render function #93

Open
nippur72 opened this issue Jan 4, 2016 · 0 comments
Open

avoid to embed "mergeProps" on every render function #93

nippur72 opened this issue Jan 4, 2016 · 0 comments

Comments

@nippur72
Copy link
Contributor

nippur72 commented Jan 4, 2016

If you use rt-props with style or class the function mergeProps is embedded in the render function.

The problem is that if you have lot of components, it is embedded everytime despite being the same exact function.

Can we have a way to make it global or something similar, so that it is specified once for all?

A possible solution could be having a command line switch to tell that mergeProps is passed with require(). Or perhaps we could pass it in _.

This is the function I'm talking about:

function mergeProps(inline, external) {
    var res = _.assign({}, inline, external);
    if (inline.hasOwnProperty('style')) {
        res.style = _.defaults(res.style, inline.style);
    }
    if (inline.hasOwnProperty('className') && external.hasOwnProperty('className')) {
        res.className = external.className + ' ' + inline.className;
    }
    return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant