I don't use React.SFC.
I have used the React component just like:
export default class Heading extends React.Component<Props, {}>
maybe you will use the below code, I think you will find the solution:
interface HeadingProps {
tabIndex: any,
}
export const Heading: React.SFC<HeadingProps> = ({ level, className, tabIndex, children, ...rest }) => {
const Tag = `h${level}`;
return (
<Tag className={cs(className)} {...rest} tabIndex={tabIndex}>
{children}
</Tag>`enter code here`
);
};
and also need to define the tabIndex in level class.
my code:
import Level from './component/level';
interface HeadingProps {
className: string,
tabIndex: any,
}
export default class Heading extends React.Component<HeadingProps, {}>{
render(){
const {className, tabIndex}
return (
<Level className={cs(className)} {...this.props.rest} tabIndex=
{tabIndex}>
{this.props.children}
</Level>
);
};
}
interface Props {
tabIndex: any,
}
export default class Level extends React.Component<Props, {}> {
render(){
return (
<h1 tabIndex={tabIndex}>
{this.props.text}
</h1>
)
}
}