mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-21 15:52:02 +00:00
RouterContext renamed to HistoryContext
This commit is contained in:
parent
37549ad6f7
commit
94a0463570
4 changed files with 19 additions and 17 deletions
5
src/app/historyContext.js
Normal file
5
src/app/historyContext.js
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
const HistoryContext = React.createContext();
|
||||||
|
|
||||||
|
export default HistoryContext;
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
const RouterContext = React.createContext();
|
|
||||||
|
|
||||||
export default RouterContext;
|
|
||||||
14
src/app/withHistory.js
Normal file
14
src/app/withHistory.js
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import React from 'react';
|
||||||
|
import HistoryContext from './historyContext';
|
||||||
|
|
||||||
|
const withHistory = (Component) => {
|
||||||
|
return function WithHistory(props) {
|
||||||
|
return (
|
||||||
|
<HistoryContext.Consumer>
|
||||||
|
{context => <Component {...props} {...context} />}
|
||||||
|
</HistoryContext.Consumer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default withHistory;
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
import RouterContext from './routerContext';
|
|
||||||
|
|
||||||
const withRouter = (Component) => {
|
|
||||||
return (props) => (
|
|
||||||
<RouterContext.Consumer>
|
|
||||||
{context => <Component {...props} {...context} />}
|
|
||||||
</RouterContext.Consumer>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default withRouter;
|
|
||||||
Loading…
Reference in a new issue