Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 275x 35459x 30659x | /*
If yuo ever feel unsure in case of hidding a component from the UI if
the best is to remove the instantion of the component on render, then use this
wrapper
*/
import React from "react";
interface Props {
hidden?: boolean;
children: React.ReactElement;
}
export const HiddenComponent = ({ hidden = true, children }: Props) => {
//Normally I would return a div with display:none, but then we add a new HTML Node
if (hidden) return null;
return children;
};
|