Electron 应用程序中的 propTypes 警告
propTypes warning in Electron app
我正在尝试处理关于需要在 NPM 程序中包含 prop-types 包的新警告。我的应用是电子应用。
我想我正在遵循 React 人员的迁移策略:https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html
react 版本 15.4.2,prop-types 版本 15.5.8,react-dom15.42.2
然而,我在添加 prop-types 包后仍然收到警告。
这是组件 (Dashboard.jsx)
const React = require('react')
const { Component } = require('react')
const {} = require('react-bootstrap')
import PropTypes from 'prop-types'
import { App, Title, Section, Header, Footer, Columns, Box, Button } from 'grommet'
export const Page = props => (
<App>
<Title>Dashboard Version 1.0, Node version: xxx</Title>
<Section>Status Section
<p>Status: {props.serverState}</p>
</Section>
<Section >{/* colorIndex='neutral-1' */ }
<Header>Controls</Header>
<Columns>
<Box pad='small'>
<Button label='Install' onClick={props.installAct}></Button>
</Box>
<Box pad='small'>
<Button label='UnInstall' onClick={props.uninstallAct}></Button>
</Box>
<Box pad='small'>
<Button label='Start' onClick={props.startAct}></Button>
</Box>
<Box pad='small'>
<Button label='Stop' onClick={props.stopAct}></Button>
</Box>
</Columns>
</Section>
<Section>
<Header>Config</Header>
</Section>
<Section>
<Header>Cleanup</Header>
</Section>
<Footer></Footer>
</App>
)
这是主要的渲染过程(dash.js)
const { ipcRenderer, remote } = require('electron')
const { createStore } = require('redux')
const { composeWithDevTools } = require('redux-devtools-extension')
const { Page } = require('../jsxo/Dashboard.js')
const React = require('react');
const ReactDOM = require('react-dom')
const PropTypes = require('prop-types')
const Immutable = require('immutable')
document.addEventListener("DOMContentLoaded", render)
const page = React.createElement(Page, { serverState: 'UP',
installAct: () => alert('install'),
uninstallAct: () => alert('uninstall'),
startAct: () => alert('start'),
stopAct: () => alert('stop') })
function render() {
ReactDOM.render(page, document.getElementById('page'))
}
您使用的 grommet
尚未更新到新的 react
版本,因此您将从该库收到警告,因为它使用了已弃用的 PropTypes
react
模块。
在您的依赖项也更新之前,您无能为力。
注意这已经 reported 并且有一个拉取请求打开。
我正在尝试处理关于需要在 NPM 程序中包含 prop-types 包的新警告。我的应用是电子应用。
我想我正在遵循 React 人员的迁移策略:https://facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html
react 版本 15.4.2,prop-types 版本 15.5.8,react-dom15.42.2
然而,我在添加 prop-types 包后仍然收到警告。
这是组件 (Dashboard.jsx)
const React = require('react')
const { Component } = require('react')
const {} = require('react-bootstrap')
import PropTypes from 'prop-types'
import { App, Title, Section, Header, Footer, Columns, Box, Button } from 'grommet'
export const Page = props => (
<App>
<Title>Dashboard Version 1.0, Node version: xxx</Title>
<Section>Status Section
<p>Status: {props.serverState}</p>
</Section>
<Section >{/* colorIndex='neutral-1' */ }
<Header>Controls</Header>
<Columns>
<Box pad='small'>
<Button label='Install' onClick={props.installAct}></Button>
</Box>
<Box pad='small'>
<Button label='UnInstall' onClick={props.uninstallAct}></Button>
</Box>
<Box pad='small'>
<Button label='Start' onClick={props.startAct}></Button>
</Box>
<Box pad='small'>
<Button label='Stop' onClick={props.stopAct}></Button>
</Box>
</Columns>
</Section>
<Section>
<Header>Config</Header>
</Section>
<Section>
<Header>Cleanup</Header>
</Section>
<Footer></Footer>
</App>
)
这是主要的渲染过程(dash.js)
const { ipcRenderer, remote } = require('electron')
const { createStore } = require('redux')
const { composeWithDevTools } = require('redux-devtools-extension')
const { Page } = require('../jsxo/Dashboard.js')
const React = require('react');
const ReactDOM = require('react-dom')
const PropTypes = require('prop-types')
const Immutable = require('immutable')
document.addEventListener("DOMContentLoaded", render)
const page = React.createElement(Page, { serverState: 'UP',
installAct: () => alert('install'),
uninstallAct: () => alert('uninstall'),
startAct: () => alert('start'),
stopAct: () => alert('stop') })
function render() {
ReactDOM.render(page, document.getElementById('page'))
}
您使用的 grommet
尚未更新到新的 react
版本,因此您将从该库收到警告,因为它使用了已弃用的 PropTypes
react
模块。
在您的依赖项也更新之前,您无能为力。
注意这已经 reported 并且有一个拉取请求打开。