import React from 'react';
import PropTypes from 'prop-types';
// <Pt name={1} />
export default class Pt extends React.Component {
static propTypes = {
type: PropTypes.string
};
render() {
return (
<h1> { this.props.name } </h1>
)
};
};
import React from 'react';
import PropTypes from 'prop-types';
// <Pt name={1} />
export default class Pt extends React.Component {
static propTypes = {
type: PropTypes.string
};
render() {
return (
<h1> { this.props.name } </h1>
)
};
};
13 回答13.1k 阅读
7 回答2.3k 阅读
3 回答1.4k 阅读✓ 已解决
6 回答1.5k 阅读✓ 已解决
2 回答1.5k 阅读✓ 已解决
3 回答1.5k 阅读✓ 已解决
2 回答1.2k 阅读✓ 已解决
不是required的话,没传参数不会报错。除非你传了非string的值