Skip to content

Instantly share code, notes, and snippets.

View charly-palencia's full-sized avatar

charly palencia charly-palencia

View GitHub Profile
import { createStore, applyMiddleware, compose } from "redux";
import history from "./history";
import { routerMiddleware } from "connected-react-router";
import thunk from "redux-thunk";
import rootReducer from "./reducers";
const initialState = {};
const enhancers = [];
const middleware = [thunk, routerMiddleware(history)];
if (process.env.NODE_ENV === "development") {
const devToolsExtension = window.__REDUX_DEVTOOLS_EXTENSION__;
import { combineReducers } from "redux";
import { connectRouter } from "connected-react-router";
import history from "../history";
export default combineReducers({
router: connectRouter(history)
});
import { createBrowserHistory } from "history";
const history = createBrowserHistory();
export default history;
import { BrowserRouter as Router, Route } from "react-router-dom";
import Home from "./pages/Home";
<Router>
<Header>
...
<StyledLink to="/home">Home page</StyledLink>
<StyledLink to="/">Index page</StyledLink>
<Route path="/home" exact component={Home} />
</Header>
@charly-palencia
charly-palencia / components-with-link.js
Created June 14, 2019 04:11
Update styled components using Link router component
import React from "react";
const Home = () => (
<h1>
Hi from Home Page!
</h1>
);
export default Home;
import GlobalStyles from "./globalStyles";
...
function App() {
return (
<AppContainer>
<GlobalStyle/>
...
</AppContainer>
);
}
import GlobalStyles from "./globalStyles";
...
function App() {
return (
<AppContainer>
<GlobalStyle/>
...
</AppContainer>
);
}
curl -L resolve-node.now.sh/lts
$ nvm install lts/dubnium