Comments (3)
嗯 React Router 4 由于放弃了 createBrowserHistory 的形式,必须从 BrowserRouter 里面获取 history 对象, 可以考虑一下如下的方式。
import { BrowserRouter, withRouter } from 'react-router-dom';
const Application (props) => {
useEffect(() => {
const { history, path, location } = this.props;
if (location.path !== props.path) {
history.push(path);
}
}, [props.path]);
return (
/* 你要渲染的路由 */
);
}
const App = withRouter(Application);
export default mount(
(props) => (
<BrowserRouter>
<App {...props} />
</BrowserRouter>
),
document.getElementById('app'),
appID
);
from alibabacloud-alfa.
如要要做多页面缓存的话,子应用之间的数据要缓存起来怎么做好些
from alibabacloud-alfa.
可以通过在宿主里面做个缓存池,然后通过 应用和宿主的通行 做数据的缓存。 比如在 应用写在的时候通过 事件通信 的方式存一下状态,然后在应用加载的时候 宿主 通过 props 注入 之前 子应用保存的状态
from alibabacloud-alfa.
Related Issues (20)
- 子应用在本地开发时,无法热更新,如何解决
- 跟icestark比起来有啥优势么,看代码复杂度很高,但实际跟飞冰的原理基本一样 HOT 3
- vue子应用如何接受props? HOT 1
- demo中的React子应用出错
- React子项目中用到jQuery HOT 2
- 打正式包 需要Access-Control-Allow-Origin HOT 5
- postcss-prefix-wrapper 对 font-family 处理有误 HOT 1
- example运行起来后报错 HOT 1
- 在同一个区域切换子应用的示例 HOT 4
- Umi架构下的应用,目前无法成为子应用 HOT 2
- 是否支持vite构建作为子应用 HOT 3
- 支持blazor webassembly框架吗?.net 系的 HOT 1
- ng-portal是否可以可以更新一下? HOT 3
- 保持宿主路由同步后浏览器返回前进按钮功能失效 HOT 1
- 刷新页面后子应用返回首页 HOT 1
- 兼容性问题:browser-vm模块是否可以不使用 es6 Proxy 实现?
- 您好,关于angular,我没在官网看到当angular作为子应用时的demo HOT 1
- 项目支持vue3吗? 没看到有vue3的demo HOT 1
- 官网更新 HOT 2
- 如何实现一个更加纯粹的iframe HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alibabacloud-alfa.