indexiatech / re-notif

Redux & React based Notifications center.

Home Page:http://indexiatech.github.io/re-notif

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom Component Errors/Warnings

prescottprue opened this issue · comments

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

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!