Today I Learned

A Hashrocket project

Ready to join Hashrocket? Find Openings here and apply today.

Use react component prop in TypeScript

Use JSX.Element when you want to accept a component as a prop:

interface Props {
  rightContent: JSX.Element;
}

class Content extends Component {
  render() {
    <Row>
      <Text>Hi There</Text>
      <RightContent>{this.props.rightContent}</RightContainer>
    </Row>
  }
}
Looking for help? At Hashrocket, our JavaScript experts launch scalable, performant apps on the Web, Android and iOS. Contact us and find out how we can help you.