如何在ReactJS/nextjs-to中将值从父级传递到子级

如何在ReactJS/nextjs-to中将值从父级传递到子级,reactjs,next.js,Reactjs,Next.js,我是reactjs/nextjs新手,需要一些关于如何将值从一个页面传递到另一个页面的帮助 我想将“Apply.jsx”页面中的值传递到confirmation.jsx页面。该值为“name=joe” Apply.jsx Router.push({ pathname: "/jobseeker/confirmation" }) 确认。jsx。(需要在此函数中获取值) const Confirmation=props=>{ const{children,

我是reactjs/nextjs新手,需要一些关于如何将值从一个页面传递到另一个页面的帮助

我想将“Apply.jsx”页面中的值传递到confirmation.jsx页面。该值为“name=joe”

Apply.jsx

Router.push({
            pathname: "/jobseeker/confirmation" })
确认。jsx。(需要在此函数中获取值)

const Confirmation=props=>{
const{children,class,view,…rest}=props;
返回(
);
};
导出默认样式(blogsStyle)(确认);

您可以将其作为查询传递

consthandler=()=>{
路由器推送({
路径名:“/求职者/确认”,
查询:{name:'joe'},
})
}
Confirmation
中,您可以使用
useRouter
hook检索它

const Confirmation=props=>{
const router=useRouter();
console.log(router.query)/{name:'joe'}
const{children,class,view,…rest}=props;
....
};
  const Confirmation = props => {
      const { children, classes, view, ...rest } = props;
    
      return (
        <div className="cd-section" {...rest}>
          <CardWithoutImg bold view="Seeker" link="confirm" orientation="left" />
        </div>
      );
    };

export default withStyles(blogsStyle)(Confirmation);