导航与react.js单页的应用程序 [英] Navigation in a single page app with react.js

查看:86
本文介绍了导航与react.js单页的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在建设有反应,骨干网单页的应用程序,我试图找出在应用处理的内容之间的导航的最佳实践。我的应用程序将有一个带有链接的侧边栏,例如,照片和设置。侧边栏总是present,所以在单击设置我要设置组件而不需要将整个刷新页面呈现。斯莱克就是我要找的,在这里点击不同的信道切换谈话内容的一个很好的例子,但不重新加载整个页面。

I'm building a single page application with React and Backbone and am trying to figure out best practices for handling navigation between content in the app. My app will have a sidebar with links, for example, to "photos" and "settings". The sidebar is always present, so upon clicking "settings" I want the settings component to be rendered without the entire page reloading. Slack is a great example of what I'm looking for, where clicking a different channel switches the conversation content, but does not reload the entire page.

我对如何实现这几个想法,但我不知道什么是最好的:

I had a few ideas on how to implement this, but i'm not sure what's best:


  1. 有一个大致的反应是接受urlparameter为道具,以确定渲染的内容(照片或设置)组件(console.jsx)。

或2有一个大致的反应组件,并定义的状态变量重新presents呈现哪些内容。

or 2. have a general react component and define a state variable that represents which content to render.

任何帮助将大大AP preciated!

Any help would be greatly appreciated!

推荐答案

你有没有听说过反应路由器?似乎是你想要的。
反应路由器

Have you heard about react router? Seems to be what you want. react router

这篇关于导航与react.js单页的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆