Advertisement
Uno-Dan

Test page

Mar 19th, 2021
722
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. import React, { useState, useEffect, useRef } from 'react'
  3. import { getImage } from '../pages'
  4. import { elm } from '../../scripts/test.js'
  5. import { useParams } from 'react-router-dom'
  6.  
  7.  
  8. const Test = ( props ) => {
  9.   const [ image, setImage ] = useState( false )
  10.   const [ loading, setLoading ] = useState( false )
  11.  
  12.   console.log( 8881111, props.items )
  13.  
  14.   useEffect(() => {
  15.     load( '/assets/images/static/loading.gif' );
  16.     test( '/assets/images/static/test/lotto649-canada-logo.png' );
  17.   }, [])
  18.  
  19.   const test = async ( url ) => {
  20.     getImage( url )
  21.     .then(blob => {
  22.       let img =
  23.        <img
  24.         src={ URL.createObjectURL( blob ) }
  25.         alt='add something here.'
  26.         width='1232px'
  27.         height='765px'
  28.       />
  29.     setImage( img )
  30.     });
  31.   }
  32.  
  33.   const load = async ( url ) => {
  34.     getImage( url )
  35.     .then(blob => {
  36.       let img =
  37.        <img
  38.         src={ URL.createObjectURL( blob ) }
  39.         alt='add something here2.'
  40.         width='auto'
  41.         height='auto'
  42.       />
  43.     setImage( loading )
  44.     });
  45.   }
  46.  
  47.   return (
  48.     <React.Fragment>
  49.       <div>THE TEST PAGE</div>
  50.       { loading }
  51.       { image }
  52.     </React.Fragment>
  53.   );
  54. }
  55.  
  56. export default Test;
  57. //
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement