File tree 3 files changed +35
-0
lines changed
3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < title > Title</ title >
6
+ </ head >
7
+ < body >
8
+ < div id ="root "> </ div >
9
+ < script src ="./index.js "> </ script >
10
+ </ body >
11
+ </ html >
Original file line number Diff line number Diff line change
1
+ import React from "react" ;
2
+ import ReactDOM from "react-dom" ;
3
+ import useFetch from "../../index" ;
4
+
5
+
6
+ const App = ( ) => {
7
+ const { isLoading, data} = useFetch ( `https://swapi.co/api/people/1` ) ;
8
+
9
+ console . log ( isLoading , data ) ;
10
+
11
+ return < div >
12
+ < p > isLoading: { isLoading && "true" || "false" } </ p >
13
+ < p > Name: { data && data . name } </ p >
14
+ </ div >
15
+ } ;
16
+
17
+
18
+ if ( root ) {
19
+ ReactDOM . render (
20
+ < App /> ,
21
+ document . getElementById ( "root" )
22
+ ) ;
23
+ }
Original file line number Diff line number Diff line change 9
9
"test" : " jest --silent" ,
10
10
"size" : " size-limit" ,
11
11
"lint" : " eslint '**/*.{js,jsx}' --quiet" ,
12
+ "run:example:basic" : " parcel ./examples/basic/index.html" ,
12
13
"run:example:depends" : " parcel ./examples/depends/index.html" ,
13
14
"run:example:pagination" : " parcel ./examples/pagination/index.html --no-cache" ,
14
15
"prepublish" : " npm run flow:check && npm run typescript && npm run lint && npm run size && npm run test"
You can’t perform that action at this time.
0 commit comments