suankularb-wittayalai-school / sk-components

A design system for all Suankularb applications
https://sk-components-demo.mysk.school
0 stars 1 forks source link

Some components fail to render when child not JSX Element #99

Closed SiravitPhokeed closed 1 year ago

SiravitPhokeed commented 1 year ago

Describe the bug If one of the children of a Section or Nav Drawer component is not a JSX Element (i.e. a text leaf) will cause the entire component to fail to render, and sometimes even throw. There may be components that suffer from this that I missed,

To reproduce Steps to reproduce the behavior:

  1. Add a non-JSX Element child to a Section or a Nav Drawer, for example:
    <Section>
    <p>This is OK</p>
    {false && <p>This is not</p>}
    Nor is this
    </Section>
  2. It will throw (if not, the build will fail)

Expected behavior A non-JSX Element child should not cause the entire component to fail to render. The component should just ignore non-JSX Element children and render them normally.

Browser Edge 111.0.1661.44