Estoy tratando de reescribir este componente jsx a tsx, pero lo he intentado de varias maneras y hasta ahora no he podido recrear este componente para usarlo en un proyecto mecanografiado. Si me pueden ayudar se los agradeceré. Dejaré el código a continuación.
import { Children } from 'react'; import { If } from './If'; export const Show = props => { let when = null; let otherwise = null; Children.forEach(props.children, children => { if (children.props.isTrue === undefined) { otherwise = children; } else if (!when && children.props.isTrue === true) { when = children; } }); return when || otherwise; }; Show.When = If; Show.Else = ({ render, children }) => render ? render() : children; Componente If //// export const If = ({isTrue, children}) => isTrue ? children : null;