android 设备未调用 ComponentWillMount()
ComponentWillMount() not invoked on android device
android 上 React-native 的绝对初学者。这是我的第一个障碍。
为什么在 render() 方法之后不调用 ComponentWillMount() 方法。在 Android 设备 (5.0) 上测试。
ComponentWillMount() {
console.log('ComponentWillMount method');
}
ComponentDidMount() {
console.log('ComponentDidMount method');
}
render() {
console.log('In render method');
return (
<View>
<Text> bla bla</Text>
</View>
);
}
根据 React 文档及其规范,ComponentWillMount() 在 render() 方法之前触发,而不是之后。
编辑:看起来像一个类型,函数名称是"componentWillMount",而不是"ComponentWillMount"。
欢迎来到 JS 世界
android 上 React-native 的绝对初学者。这是我的第一个障碍。
为什么在 render() 方法之后不调用 ComponentWillMount() 方法。在 Android 设备 (5.0) 上测试。
ComponentWillMount() {
console.log('ComponentWillMount method');
}
ComponentDidMount() {
console.log('ComponentDidMount method');
}
render() {
console.log('In render method');
return (
<View>
<Text> bla bla</Text>
</View>
);
}
根据 React 文档及其规范,ComponentWillMount() 在 render() 方法之前触发,而不是之后。
编辑:看起来像一个类型,函数名称是"componentWillMount",而不是"ComponentWillMount"。
欢迎来到 JS 世界