File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -48,24 +48,29 @@ yarn add @use-hooks/image-size
4848
4949``` js
5050import React from ' react' ;
51+
5152import useImageSize from ' @use-hooks/image-size' ;
5253
5354export default function App () {
5455 const url = ' https://cdn.int64ago.org/ogk39i54.png' ;
55-
5656 const [width , height ] = useImageSize (url);
5757
5858 return (
5959 < div>
60- Natural size: {width} x {height}
60+ < h2> DEMO of < span style= {{ color: ' #F44336' }}> @use- hooks/ image- size< / span>< / h2>
61+ < div>
62+ < img src= {url} width= {100 } height= {100 } alt= " " / >
63+ < div> Natural size: {width} x {height}< / div>
64+ < / div>
6165 < / div>
6266 );
6367}
68+
6469```
6570
66- See ` ./example ` for a full [ example ] ( https://use-hooks.github.io/react-hooks-image-size/ ) .
71+ [ Live Show ] ( https://use-hooks.github.io/react-hooks-image-size/ )
6772
68- ## Have a try
73+ ## Development
6974
7075> Node >= v8 LTS
7176
Original file line number Diff line number Diff line change 11{
22 "name" : " @use-hooks/image-size" ,
33 "version" : " 1.0.0" ,
4- "description" : " Custom React Hooks for image natural size" ,
4+ "description" : " Custom React Hooks for image natural size. " ,
55 "main" : " dist/index.js" ,
66 "files" : [
77 " dist"
1111 "start" : " webpack-dev-server --progress --color" ,
1212 "build" : " webpack --env build" ,
1313 "example" : " webpack --env example" ,
14+ "readme" : " use-hooks-readme" ,
1415 "lint" : " eslint src example" ,
1516 "lint:fix" : " eslint src example --fix" ,
1617 "prepublishOnly" : " npm run build"
4546 "jest" : " ^23.6.0" ,
4647 "lint-staged" : " ^8.1.0" ,
4748 "regenerator-runtime" : " ^0.13.1" ,
49+ "use-hooks-readme" : " ^1.0.1" ,
4850 "webpack" : " ^4.27.1" ,
4951 "webpack-cli" : " ^3.1.2" ,
5052 "webpack-dev-server" : " ^3.1.10"
5860 "*.{js,jsx}" : [
5961 " eslint --fix" ,
6062 " git add"
63+ ],
64+ "*.{js,jsx,json}" : [
65+ " use-hooks-readme" ,
66+ " git add README.md"
6167 ]
6268 },
6369 "dependencies" : {
You can’t perform that action at this time.
0 commit comments