📜  反应中的随机图片位置 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:43.998000             🧑  作者: Mango

代码示例1
import React, { useRef } from 'react';
    
const Image = () => {
   const ChipStyles = useRef({
       position: 'absolute',
       top: Math.floor(Math.random()*50),
       left: '50%',
       transform: 'translate(-50%, -50%)'
   });

   return (
     
   )
}
    
export default Image