11import React , { Component } from 'react' ;
22import axios from 'axios' ;
3- import PropTypes from 'prop-types' ;
43import './App.css' ;
54
65const DEFAULT_QUERY = 'redux' ;
@@ -160,36 +159,22 @@ class App extends Component {
160159 }
161160}
162161
163- class Search extends Component {
164- componentDidMount ( ) {
165- if ( this . input ) {
166- this . input . focus ( ) ;
167- }
168- }
169-
170- render ( ) {
171- const {
172- value,
173- onChange,
174- onSubmit,
175- children
176- } = this . props ;
177-
178- return (
179- < form onSubmit = { onSubmit } >
180- < input
181- type = "text"
182- value = { value }
183- onChange = { onChange }
184- ref = { el => this . input = el }
185- />
186- < button type = "submit" >
187- { children }
188- </ button >
189- </ form >
190- ) ;
191- }
192- }
162+ const Search = ( {
163+ value,
164+ onChange,
165+ onSubmit,
166+ children
167+ } ) =>
168+ < form onSubmit = { onSubmit } >
169+ < input
170+ type = "text"
171+ value = { value }
172+ onChange = { onChange }
173+ />
174+ < button type = "submit" >
175+ { children }
176+ </ button >
177+ </ form >
193178
194179const Table = ( { list, onDismiss } ) =>
195180 < div className = "table" >
@@ -219,22 +204,10 @@ const Table = ({ list, onDismiss }) =>
219204 ) }
220205 </ div >
221206
222- Table . propTypes = {
223- list : PropTypes . arrayOf (
224- PropTypes . shape ( {
225- objectID : PropTypes . string . isRequired ,
226- author : PropTypes . string ,
227- url : PropTypes . string ,
228- num_comments : PropTypes . number ,
229- points : PropTypes . number ,
230- } )
231- ) . isRequired ,
232- onDismiss : PropTypes . func . isRequired ,
233- } ;
234207
235208const Button = ( {
236209 onClick,
237- className,
210+ className = '' ,
238211 children,
239212} ) =>
240213 < button
@@ -245,16 +218,6 @@ const Button = ({
245218 { children }
246219 </ button >
247220
248- Button . defaultProps = {
249- className : '' ,
250- } ;
251-
252- Button . propTypes = {
253- onClick : PropTypes . func . isRequired ,
254- className : PropTypes . string ,
255- children : PropTypes . node . isRequired ,
256- } ;
257-
258221export default App ;
259222
260223export {
0 commit comments