dmk99 / react-pdf-table

Storybook Available
https://dmk99.github.io/react-pdf-table
MIT License
153 stars 62 forks source link

Use optional chaining for checking type property #32

Closed cwstra closed 2 years ago

cwstra commented 3 years ago

At present, the Table component will throw an error if it has a null or undefined child, due to the property access I've altered. By using optional chaining, this should no longer cause an issue.

I ran into this when I used an optional boolean argument to conditionally render a header. Not having a header also causes an issue with rendering the table's top border, so I also tweaked the rendering of TableBody to mitigate that.