i want to make a toggle div by react spring but i got this error (TypeError: Object(...) is not a function)
import React , {useState} from 'react'
import { useSpring ,animated} from 'react-spring/renderprops'
const Togg =()=>{
const [isToggled,setToggle]= useState(false);
const fade = useSpring({
opacity : isToggled ? 1 : 0
});
return(
<div>
<animated.h1 style={fade}>hello</animated.h1>
<button onClick={()=>setToggle(!isToggled)}>Toggle This</button>
</div>
);
}
export default Togg
Your import statement should be import {useSpring, animated} from 'react-spring'
.