базовый поиск

This commit is contained in:
Alexey Kasyanchuk
2017-01-01 06:25:04 +03:00
parent 46708c8f7e
commit 1b6a15bcdd
4 changed files with 64 additions and 17 deletions

View File

@ -5,12 +5,14 @@ var io = require("socket.io-client");
window.torrentSocket = io('http://localhost:8099/');
import RecentTorrents from './recent-torrents'
import Search from './search'
class App extends Component {
render() {
return (
<div className="App">
<RecentTorrents />
<Search />
</div>
);
}

20
src/search.js Normal file
View File

@ -0,0 +1,20 @@
import React, { Component } from 'react';
export default class Search extends Component {
componentDidMount() {
}
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>
);
}
}