Skip to content

Custom Component Errors/Warnings #50

@prescottprue

Description

@prescottprue

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions