Replies: 1 comment 2 replies
-
I decided to rely only on the React warning, see:
We can change this decision in the future if this turns out to be a recurring problem. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! 👋 This is a design decision question. I am looking for what's better from the developer's point of view.
So basically, nesting of some HTML elements is not allowed. For example:
With SX Design you can write something like this (equivalent of the HTML code above):
In this situation React itself prints the following warning (related React tests):
However, it's not a hard error - it's just a console warning. In other words, SX Design allows the creation of invalid HTML. Does it make sense to prevent this behavior and throw an invariant error instead? The implementation is not complicated, I basically have it done - just not sure if it's the right thing to do (or we should just keep the React warning and move on).
Why do I even bother with this question?
I encountered this situation in my application when I was sending
<Text/>
component from my application to SX Design and I created these nested paragraphs completely by mistake (I didn't know the underlying component uses<Text/>
as well). And, of course, I managed to integrate this code without noticing the warning. 🙈Beta Was this translation helpful? Give feedback.
All reactions