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

Custom Component Errors/Warnings #50

Open
prescottprue opened this issue Dec 8, 2016 · 1 comment
Open

Custom Component Errors/Warnings #50

prescottprue opened this issue Dec 8, 2016 · 1 comment

Comments

@prescottprue
Copy link

When trying to use a custom component, one can trying passing a string or a whole component.

String

Does not seem to be a common pattern for passing a component

<Notifs CustomComponent={Snackbar} />

Problems

  • Does not allow props to be passed
  • Passes all props (warning will throw for unnecessary props):

screen shot 2016-12-07 at 4 05 26 pm

Full Component

Seems to the common method of accepting a component as a prop used in Libraries like material-ui like here. That way props can be passed and set within the component (like you are doing with key).

<Notifs CustomComponent={<Snackbar open message="some" />} />

Problems

  • Throws invalid element type warning:

screen shot 2016-12-07 at 3 57 19 pm

  • Even after changing src to allow this, the addComponentAsRefTo is still thrown (might be due to npm-linking causing react version conflicts):

screen shot 2016-12-07 at 3 24 06 pm

@kylecesmat
Copy link
Collaborator

kylecesmat commented Dec 15, 2016

Thanks for this report! I'll look into reproducing this. I know the CustomComponent API could be beefed up, it was created for a small handful of usecases and the ones you've outlined seem likely.

If I have time I'll take a stab at a PR, but would love help from others!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants