我正在ReactXP项目中工作,我必须使用React Native 本机模块.
所以我将react-native类型包含为dev依赖项.
我的项目现在没有编译,但有以下错误:
node_modules/@types/react-native/globals.d.ts(92,14): error TS2300: Duplicate identifier 'RequestInfo'.
node_modules/@types/react-native/index.d.ts(8751,11): error TS2451: Cannot redeclare block-scoped variable 'console'.
node_modules/@types/react-native/index.d.ts(8759,18): error TS2717: Subsequent property declarations must have the same type. Property 'geolocation' must be of type 'Geolocation', but here has type 'GeolocationStatic'.
node_modules/@types/react-native/index.d.ts(8762,11): error TS2451: Cannot redeclare block-scoped variable 'navigator'.
node_modules/typescript/lib/lib.dom.d.ts(15764,13): error TS2451: Cannot redeclare block-scoped variable'navigator'.
node_modules/typescript/lib/lib.dom.d.ts(15940,13): error TS2451: Cannot redeclare block-scoped variable'console'.
node_modules/typescript/lib/lib.dom.d.ts(15997,6): error TS2300: Duplicate identifier 'RequestInfo'.
18:17:44 - Compilation complete. Watching for file changes.
Run Code Online (Sandbox Code Playgroud)
以下是我的package.json文件: …
微软最近发布的ReactXP文档目前没有太多关于RX.Component
该类的信息.
以下是文档中的示例:
class HelloWorld extends RX.Component<void, void> {
render() {
return <RX.Text>Hello World</RX.Text>;
}
}
Run Code Online (Sandbox Code Playgroud)
RX.Component
比React.Component
?Component
类的生命周期?这对我来说是一个重要的考虑因素,因为React组件的最佳实践通常会鼓励组合而不是继承,除非是非常基本的场景PureComponent
.提供的功能是否可以RX.Component
证明继承的合理性?