feat(FelaComponent): Allow style prop with empty value#675
Conversation
|
The point was that you don't need a wrapping FelaComponent without a style as you can simply render a div as well. But fair enough, it seems like a legit use case to pass undefined / null. |
robinweser
left a comment
There was a problem hiding this comment.
I will merge it in and release for now, but maybe we should log a warning in devMode? So people see that path and might fix it later on. I don't think sth. like that will ever get a perf issue, but after all we render unnecessary components here.
Happy to do this. Did you release already? |
|
Not yet, but was about to do that soonish. But I'll have another release at the end of the week anyways :P |
|
Actually, how would you know if we are in dev mode inside FelaComponent? |
|
|
|
Work just got really crazy, I don't think I'll manage to get to it today. Let's jus make sure to do this later |
Description
Since v10, FelaComponent throws if the
styleprop isnullorundefined, which I think is wrong.It's quite an edge case, but sometimes one may want an element to only be styled under certain conditions, and have that be determined dynamically.
The easiest and most straightforward way to do that is to pass
nulltoFelaComponent's style prop from the parent component.By removing the check and
throwstatement, it works as expected, so I don't really see any benefit in having it there. It doesn't really add any DX value, and is overly restrictiveExample
Packages
fela-bindings
Versioning
Patch
Checklist
Quality Assurance
yarn run format)yarn run lint)yarn run test)yarn run flow)Changes
If one of the following checks doesn't make sense due to the type of PR, just check them.