React-search 基本示例 [英] React-search basic example
问题描述
我正在尝试让
有什么想法吗?
我看看他们的源代码:https://github.com/StevenIseki/react-search/blob/master/src/Search.js
import React, { Component, PropTypes } from 'react'
React 有一个中断更改,其中 PropTypes
不再位于 react 包中.
它现在在 prop-types
包中.例如:从 'prop-types' 导入 PropTypes
如果你还想使用这个包,你必须匹配https://github.com/StevenIseki/react-search/blob/master/package.json
然而,这个包的实现并不难.因此,如果需要,您强烈建议您根据他们的代码创建自己的组件.
这有帮助吗?
I'm trying to get react-search to work in my Meteor app. This is my main App.js in the imports folder:
import Search from 'react-search';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
...
class App extends Component {
...
render() {
let items = [
{ id: 0, value: 'ruby' },
{ id: 1, value: 'javascript' },
{ id: 2, value: 'lua' },
{ id: 3, value: 'go' },
{ id: 4, value: 'julia' }
]
console.log(items)
return (
<div class="">
<Search items={items} />
...
</div>
);
}
}
Once I insert the <Search items={items} />
my app stops working and I get the following console errors:
Any ideas?
I take a look on their source code: https://github.com/StevenIseki/react-search/blob/master/src/Search.js
import React, { Component, PropTypes } from 'react'
React had a break change where PropTypes
is no longer inside the react package.
It's in prop-types
package now. eg: import PropTypes from 'prop-types'
If you still want to use this package, you have to match the dependency in https://github.com/StevenIseki/react-search/blob/master/package.json
However, the implementation for this package isn't hard. So you highly recommend you create your own component based on their code if needed.
Does this help?
这篇关于React-search 基本示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!