简体   繁体   中英

React router path different components

在此处输入图片说明

How can we set footerNew if path is example2 and footer if we have path example. How can we change component with different path . I know this could have been done with the path mixing but that has been deprecated

The only diff you have between your routes is the pathname. So :

<div className="...">
    {props.context.router.getCurrentPathname() === '/example' ? <Footer /> : </FooterNew />}
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM