标签: reactxp

错误TS2300:重复标识符'RequestInfo'

我正在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文件: …

typescript react-native reactxp

10
推荐指数
2
解决办法
4270
查看次数

RX.Component类提供哪些功能而不是React.Component?

微软最近发布的ReactXP文档目前没有太多关于RX.Component该类的信息.

以下是文档中的示例:

class HelloWorld extends RX.Component<void, void> {
    render() {
        return <RX.Text>Hello World</RX.Text>;
    }
}
Run Code Online (Sandbox Code Playgroud)
  1. 什么是由提供的功能RX.ComponentReact.Component
  2. 它如何影响基Component类的生命周期?

这对我来说是一个重要的考虑因素,因为React组件的最佳实践通常会鼓励组合而不是继承,除非是非常基本的场景PureComponent.提供的功能是否可以RX.Component证明继承的合理性?

javascript reactjs reactxp

1
推荐指数
1
解决办法
157
查看次数

标签 统计

reactxp ×2

javascript ×1

react-native ×1

reactjs ×1

typescript ×1