File tree Expand file tree Collapse file tree 4 files changed +62
-24
lines changed Expand file tree Collapse file tree 4 files changed +62
-24
lines changed Original file line number Diff line number Diff line change 33 "version" : " 0.1.0" ,
44 "private" : true ,
55 "dependencies" : {
6+ "axios" : " ^0.18.0" ,
67 "react" : " ^16.6.0" ,
78 "react-dom" : " ^16.6.0" ,
89 "react-scripts" : " 2.0.5"
Original file line number Diff line number Diff line change 11import React , { Component } from 'react' ;
2- import logo from './logo.svg' ;
3- import './App.css' ;
2+ import axios from 'axios' ;
3+
4+ const TITLE = 'React GraphQL GitHub Client' ;
5+
6+ const axiosGitHubGraphQL = axios . create ( {
7+ baseURL : 'https://api.github.com/graphql' ,
8+ headers : {
9+ Authorization : `bearer ${
10+ process . env . REACT_APP_GITHUB_PERSONAL_ACCESS_TOKEN
11+ } `,
12+ } ,
13+ } ) ;
414
515class App extends Component {
16+ state = {
17+ path : 'the-road-to-learn-react/the-road-to-learn-react' ,
18+ } ;
19+
20+ componentDidMount ( ) {
21+ // fetch data
22+ }
23+
24+ onChange = event => {
25+ this . setState ( { path : event . target . value } ) ;
26+ } ;
27+
28+ onSubmit = event => {
29+ // fetch data
30+
31+ event . preventDefault ( ) ;
32+ } ;
33+
634 render ( ) {
35+ const { path } = this . state ;
36+
737 return (
8- < div className = "App" >
9- < header className = "App-header" >
10- < img src = { logo } className = "App-logo" alt = "logo" />
11- < p >
12- Edit < code > src/App.js</ code > and save to reload.
13- </ p >
14- < a
15- className = "App-link"
16- href = "https://reactjs.org"
17- target = "_blank"
18- rel = "noopener noreferrer"
19- >
20- Learn React
21- </ a >
22- </ header >
38+ < div >
39+ < h1 > { TITLE } </ h1 >
40+
41+ < form onSubmit = { this . onSubmit } >
42+ < label htmlFor = "url" >
43+ Show open issues for https://github.com/
44+ </ label >
45+ < input
46+ id = "url"
47+ type = "text"
48+ value = { path }
49+ onChange = { this . onChange }
50+ style = { { width : '300px' } }
51+ />
52+ < button type = "submit" > Search</ button >
53+ </ form >
54+
55+ < hr />
56+
57+ { /* Here comes the result! */ }
2358 </ div >
2459 ) ;
2560 }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments