RouterContext renamed to HistoryContext

This commit is contained in:
NikolaBorislavovHristov 2018-06-28 12:52:33 +03:00
parent 37549ad6f7
commit 94a0463570
4 changed files with 19 additions and 17 deletions

View file

@ -0,0 +1,5 @@
import React from 'react';
const HistoryContext = React.createContext();
export default HistoryContext;

View file

@ -1,5 +0,0 @@
import React from 'react';
const RouterContext = React.createContext();
export default RouterContext;

14
src/app/withHistory.js Normal file
View 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;

View file

@ -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;