Hi,
when working with TypeScript Components, it is needed to define the props definition twice:
- As the TypeScript way (
Interface and generic React Component React.Compoennt<PropsType>) for type checking in the code
- As a PropTypes definitions for being reflected in the Webcodesk UI
import React from 'react';
import PropTypes from 'prop-types';
export interface CompProps {
text: string;
}
class CompName extends React.Component<CompProps > {
static propTypes = {
text: PropTypes.string
}
static defaultProps = {
text: "Hallo World"
}
render() {
return <div>{this.props.text}</div>
}
}
export default CompName;
It would be nice when for TypeScript compoenents the TypeScript Props definition could be used to show and reflect the definition in the Webcodesk UI. That would make maintenance easier.
Hi,
when working with TypeScript Components, it is needed to define the props definition twice:
Interfaceand generic React ComponentReact.Compoennt<PropsType>) for type checking in the codeIt would be nice when for TypeScript compoenents the TypeScript Props definition could be used to show and reflect the definition in the Webcodesk UI. That would make maintenance easier.