File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
04-frameworks/01-react/03-react-hooks/07-custom-hook Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 22
33## Summary
44
5- This example takes as its starting point the \ \ _ 06-ajax-field-change example.
5+ This example takes as its starting point the _ 06-ajax-field-change _ example.
66
77Hooks are cool, but our functional component seems to get cluttered, is
88there a way to extract functionality outside the functional component?
@@ -31,13 +31,13 @@ export const MyComponent = () => {
3131 // Load full list when the component gets mounted and filter gets updated
3232 React .useEffect (() => {
3333 fetch (` https://jsonplaceholder.typicode.com/users?name_like=${filter } ` )
34- .then (( response ) => response .json ())
35- .then (( json ) => setUserCollection (json ));
34+ .then (response => response .json ())
35+ .then (json => setUserCollection (json ));
3636 }, [filter ]);
3737
3838 return (
3939 <div >
40- <input value = { filter } onChange = { ( e ) => setFilter (e .target .value )} />
40+ <input value = { filter } onChange = { e => setFilter (e .target .value )} />
4141 <ul >
4242 { userCollection .map ((user , index ) => (
4343 <li key = { index } >{ user .name } </li >
You can’t perform that action at this time.
0 commit comments