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

getSpreadableProps util #69

Closed
levithomason opened this issue Oct 20, 2015 · 1 comment
Closed

getSpreadableProps util #69

levithomason opened this issue Oct 20, 2015 · 1 comment

Comments

@levithomason
Copy link
Member

A util for getting spreadable props, to handle this use case:

let checkboxProps = _.clone(this.props);
delete checkboxProps.settings;  // all modules need to do this
delete checkboxProps.className; // this would be passed in

// then

<input {...checkboxProps} />

We need to remove props.settings from all Semantic UI Modules. Also, many components need to exclude certain props from being spread as they belong elsewhere. Like the checkbox example above, and this message example:

let messageProps = _.clone(this.props);
delete messageProps.icon;

// then

<div {...messageProps}>

The icon prop belongs as classes on the icon inside the message, then the rest of the props are spread.

This should be abstracted away with a util that understands what to do to get spreadable props.

This was referenced Oct 20, 2015
@levithomason levithomason changed the title Spreadable props util getUnknownProps util Oct 20, 2015
@levithomason levithomason reopened this Oct 20, 2015
@levithomason levithomason changed the title getUnknownProps util getSpreadableProps util Oct 20, 2015
@levithomason
Copy link
Member Author

Lack of this util is also currently resulting in double rendered children. The children are rendered once by the parent component, but also the props.children are spread onto the component, so they are rendered twice.

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