11
22import { render , unmountComponentAtNode } from 'react-dom'
3- import React from 'react'
3+ import { useEffect , useState } from 'react'
44import { act } from 'react-dom/test-utils'
55import useSVGMousePosition from '../../src/hooks/useSVGMousePosition'
66
@@ -64,7 +64,7 @@ const cases = [
6464
6565 const [ position , setTarget ] = useSVGMousePosition ( { precision } )
6666
67- React . useEffect ( ( ) => {
67+ useEffect ( ( ) => {
6868 setTarget ( document . getElementById ( 'root' ) )
6969 // Reproduce the behavior of an updated callback ref (see memo above)
7070 return ( ) => setTarget ( null )
@@ -80,7 +80,7 @@ const cases = [
8080 const [ position , setTarget , root ] = useSVGMousePosition ( { hasRoot : true , precision } )
8181
8282 // `setTarget` doesn't have to be re-initialized (see memo avove: `root` already handles it)
83- React . useEffect ( ( ) => setTarget ( document . getElementById ( 'target' ) ) , [ setTarget ] )
83+ useEffect ( ( ) => setTarget ( document . getElementById ( 'target' ) ) , [ setTarget ] )
8484
8585 return (
8686 < div id = 'root' ref = { root } >
@@ -94,7 +94,7 @@ const cases = [
9494 const [ position , target , setRoot ] = useSVGMousePosition ( { hasRoot : true , precision } )
9595
9696 // `setRoot` doesn't have to be re-initialized (see memo avove: `target` already handles it)
97- React . useEffect ( ( ) => setRoot ( document . getElementById ( 'root' ) ) , [ setRoot ] )
97+ useEffect ( ( ) => setRoot ( document . getElementById ( 'root' ) ) , [ setRoot ] )
9898
9999 return (
100100 < div id = 'root' >
@@ -119,7 +119,7 @@ const cases = [
119119
120120 const [ position , setTarget , setRoot ] = useSVGMousePosition ( { precision } )
121121
122- React . useEffect (
122+ useEffect (
123123 ( ) => {
124124 setRoot ( document . getElementById ( 'root' ) )
125125 setTarget ( document . getElementById ( 'target' ) )
@@ -141,7 +141,7 @@ const cases = [
141141
142142 const [ position , setTarget , setRoot ] = useSVGMousePosition ( { hasRoot : true , precision } )
143143
144- React . useEffect (
144+ useEffect (
145145 ( ) => {
146146 setTarget ( document . getElementById ( 'target' ) )
147147 setRoot ( document . getElementById ( 'root' ) )
@@ -162,15 +162,15 @@ const cases = [
162162 [ 'set target on consecutive updates in useEffect()' , ( { precision } ) => {
163163
164164 const [ position , setTarget , root ] = useSVGMousePosition ( { hasRoot : true , precision } )
165- const [ forcedUpdate , forceUpdate ] = React . useState ( true )
165+ const [ forcedUpdate , forceUpdate ] = useState ( true )
166166
167- React . useEffect (
167+ useEffect (
168168 ( ) => {
169169 setTarget ( document . getElementById ( 'target' ) )
170170 // `setTarget` doesn't have to be re-initialized (see memo avove: `root` already handles it)
171171 } ,
172172 [ forcedUpdate , setTarget ] )
173- React . useEffect ( forceUpdate , [ forceUpdate ] )
173+ useEffect ( forceUpdate , [ forceUpdate ] )
174174
175175 return (
176176 < div id = 'root' ref = { root } >
0 commit comments