Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

RFC: drop content prop #2205

Closed
wants to merge 1 commit into from
Closed

RFC: drop content prop #2205

wants to merge 1 commit into from

Conversation

layershifter
Copy link
Member

@layershifter layershifter commented Jan 3, 2020

RFC: Remove content as part of factories/slots

API with having content & children comes from SUIR and the goal was to create a separation between concepts: use only Children or Shorthand API 💡

image

<Button>Foo</Button> // shows Foo
<Button icon="book">Foo</Button> // do not show icon 💣 
<Button content="Foo" /> // style are different, but it's another issue

In the reality it creates more confusion than something useful, i.e. not everyone on consumer side understand how it works properly.


Sometimes content is a slot, sometimes it is a ReactNode, so you will never know what is correct way:

<Popup content={{ content: 'Foo' }} /> // works 👍 
<Header content={{ content: 'Foo' }} /> // throws 💣 

Another one is that of our components do not implement that idea properly, i.e. content & children will be rendered. During my API experiments and prototyping I found that content is useless at 🤔

<Popup content={{ content: 'Foo' }} /> // what is difference between `content` & `children`?
<Popup content={{ children: 'Foo' }} /> // what is preferred?

The best way to avoid confusion is to drop it for cases like Header and keep it for Popup. In this case:

  • 👍 no more confusion, if content exists is always slot
  • 👍 no more content={{ content }}, it will be content={{ children }} which is more clear

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

Successfully merging this pull request may close these issues.

1 participant