Answers for "typescript react component type as prop with children"

4

react props.children proptype

import PropTypes from 'prop-types'

...

static propTypes = {
    children: PropTypes.oneOfType([
        PropTypes.arrayOf(PropTypes.node),
        PropTypes.node
    ]).isRequired
}
Posted by: Guest on November-11-2020
0

children type typescript react'

import React, { ReactChildren, ReactChild } from 'react';
 
interface AuxProps {
  children: ReactChild | ReactChildren;
}

const Aux = ({ children }: AuxProps) => (<div>{children}</div>);

export default Aux;
Posted by: Guest on August-16-2021

Code answers related to "typescript react component type as prop with children"

Code answers related to "Javascript"

Browse Popular Code Answers by Language