我正在尝试处理有关需要在NPM程序中包含prop-types包的新警告。我的应用程序是电子应用程序。
我认为我正在遵循React人员的迁移策略:https : //facebook.github.io/react/blog/2017/04/07/react-v15.5.0.html
react版本15.4.2,prop-type版本15.5.8,react-dom 15.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版本的版本,因此将从该库中获取警告,因为该库使用了不推荐使用的PropTypesfrom react模块。
grommet
react
PropTypes
在依赖项也更新之前,您无能为力。
请注意,这已被报告,并且存在拉取请求。