When I create a custom component input and I'm passing all props from the parent, sometimes I want to disable some of them. In the example below I don't want to allow the user to be able to override type.
But it is not possible now. I would like to add something like PT.disabled to warn users, that this prop is prohibited to change.
const NumberInput = (props) => {
const { type, className, ...rest } = props;
return <input
type="number"
{...rest}
className={ classnames(inputStyles.number) + ' ' + className }
/>;
};
NumberInput.propTypes = {
className: PT.string,
type: PT.disabled, // Here, warn user type is not available property
};
export default NumberInput;
When I create a custom component input and I'm passing all
props
from the parent, sometimes I want to disable some of them. In the example below I don't want to allow the user to be able to overridetype
. But it is not possible now. I would like to add something likePT.disabled
to warn users, that this prop is prohibited to change.Would it be possible to add something like this?