We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getDefaultProps 并不生效,是否不支持设置props的初始值以及类型?
The text was updated successfully, but these errors were encountered:
两种方法:
class Greeting extends Taro.Component { static defaultProps = { name: 'Stranger' }; render() { return ( <h1>Hello, {this.props.name}</h1> ); } } // 或者这样 Greeting.defaultProps = { name: 'Stranger' };
Sorry, something went wrong.
class Greeting extends Taro.Component { constructor (props) { super(props) this.state = { name: ``, } } static defaultProps = { name: 'Stranger' }; render() { return ( <h1>Hello, {this.props.name}</h1> ); } }
class Greeting extends Taro.Component { constructor (props) { super(props) this.state = { name: ``, } } render() { return ( <h1>Hello, {this.props.name}</h1> ); } } Greeting.defaultProps = { name: 'Stranger' };
No branches or pull requests
getDefaultProps 并不生效,是否不支持设置props的初始值以及类型?
The text was updated successfully, but these errors were encountered: