This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom'; | |
const Routes = () => { | |
return ( | |
<Router> | |
<ul className="router-nav"> | |
<NavLink to="/">One</NavLink> | |
<NavLink to="/two">Two</NavLink> | |
<NavLink to="/three">Three</NavLink> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
export default class Refactor extends Component { | |
state = { | |
isToggled: false | |
}; | |
toggle = () => { | |
this.setState(state => { | |
return { isToggled: !state.isToggled }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loadable.preloadAll() | |
.then(() => | |
onPageLoad(async sink => { | |
try { | |
const cache = new InMemoryCache(); | |
const stateLink = withClientState({ | |
cache, | |
resolvers: stateMutations, | |
defaults: defaultState, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { StaticRouter } from 'react-router'; | |
import { ServerStyleSheet } from 'styled-components'; | |
import { onPageLoad } from 'meteor/server-render'; | |
// import { createApolloServer } from './apolloServer'; | |
import { createApolloServer } from 'meteor/apollo'; | |
import { Helmet } from 'react-helmet'; | |
import { SchemaLink } from 'apollo-link-schema'; | |
import 'isomorphic-fetch'; | |
// Apollo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { makeExecutableSchema, addMockFunctionsToSchema } from 'graphql-tools'; | |
import { graphql } from 'graphql'; | |
import GraphQLMock from 'graphql-mock'; | |
import typeDefs from 'imports/startup/both/typeDefs'; | |
// Make a GraphQL schema with no resolvers | |
const schema = makeExecutableSchema({ typeDefs }); | |
// Creates random id | |
const revisedRandId = () => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"parser": "babel-eslint", | |
"env": { | |
"browser": true, | |
"es6": true | |
}, | |
"settings": { | |
"ecmascript": 6, | |
"jsx": true | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const httpLink = new HttpLink({ uri: Meteor.absoluteUrl('graphql') }); | |
const authLink = new ApolloLink((operation, forward) => { | |
const token = Accounts._storedLoginToken(); // from local storage | |
operation.setContext(() => ({ | |
headers: { | |
'meteor-login-token': token, | |
}, | |
})); | |
return forward(operation); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const httpLink = new HttpLink({ uri: Meteor.absoluteUrl('graphql') }); | |
const authLink = new ApolloLink((operation, forward) => { | |
const token = Accounts._storedLoginToken(); // from local storage | |
operation.setContext(() => ({ | |
headers: { | |
'meteor-login-token': token, | |
}, | |
})); | |
return forward(operation); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { renderToNodeStream } from 'react-dom/server'; | |
import { StaticRouter } from 'react-router'; | |
import { ServerStyleSheet } from 'styled-components'; | |
import { onPageLoad } from 'meteor/server-render'; | |
import { Helmet } from 'react-helmet'; | |
import 'isomorphic-fetch'; | |
// Apollo | |
import { ApolloProvider, getDataFromTree } from 'react-apollo'; | |
import { ApolloClient, Observable } from 'apollo-client'; |