отображение результатов поиска

This commit is contained in:
Alexey Kasyanchuk
2017-01-01 06:40:51 +03:00
parent 1b6a15bcdd
commit 2b861167cd
2 changed files with 37 additions and 11 deletions

View File

@ -1,19 +1,22 @@
import React, { Component } from 'react';
export default class Search extends Component {
componentDidMount() {
import SearchResults from './search-results'
}
export default class Search extends Component {
render() {
return (
<div className="row">
<input type='text' ref='searchInput' onKeyPress={(e) => {
if (e.key === 'Enter') {
window.torrentSocket.emit('search', e.target.value, (torrents) => {
console.log(torrents);
});
}
}} />
<div className="column">
<div className='row'>
<input type='text' ref='searchInput' onKeyPress={(e) => {
if (e.key === 'Enter') {
window.torrentSocket.emit('search', e.target.value, (torrents) => {
this.searchData = torrents;
this.forceUpdate();
});
}
}} />
</div>
<SearchResults results={this.searchData} />
</div>
);
}