Reactjs 如何使用react使用帧运动即时更新父高度?

Reactjs 如何使用react使用帧运动即时更新父高度?,reactjs,framer-motion,Reactjs,Framer Motion,为了便于个人使用,我创建了一个带有react和framer运动的滑块组件。结构如下所示: 要在幻灯片之间切换,我在我的Slider组件中使用React.Children.toArray(),如下所示: //滑块组件 const childrenArray=React.Children.toArray(Children)作为React.ReactElement[] 常量[[page,direction],setPage]=useState([0,0]) const currentChild=c

为了便于个人使用,我创建了一个带有react和framer运动的滑块组件。结构如下所示:


要在幻灯片之间切换,我在我的
Slider
组件中使用
React.Children.toArray()
,如下所示:

//滑块组件
const childrenArray=React.Children.toArray(Children)作为React.ReactElement[]
常量[[page,direction],setPage]=useState([0,0])
const currentChild=childrenArray[页面]作为React.ReactElement
常量分页=(新方向:编号)=>{
setPage([page+newDirection,newDirection])
}
我把
currentChild
呈现如下:


返回(

您是说希望滑块的高度随着当前幻灯片的变化而变化。即,随着其内容的高度变化而变化?是的,但我该怎么做?