This file contains hidden or 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
server.get('/*', async (req, res) => { | |
const Root = () => ( | |
<ApolloProvider client={client}> | |
<ThemeProvider theme={theme}> | |
<StaticRouter location={req.url} context={context}> | |
<App /> | |
</StaticRouter> | |
</ThemeProvider> | |
</ApolloProvider> | |
) |
This file contains hidden or 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 { getDataFromTree, ApolloProvider } from 'react-apollo' | |
import client from './Utils/apollo' | |
import theme from './Utils/theme' | |
... | |
const Root = () => ( | |
<ApolloProvider client={client}> | |
<ThemeProvider theme={theme}> | |
<StaticRouter location={req.url} context={context}> | |
<App /> | |
</StaticRouter> |
This file contains hidden or 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 { InMemoryCache } from 'apollo-cache-inmemory' | |
import { ApolloClient } from 'apollo-client' | |
import { HttpLink } from 'apollo-link-http' | |
export default new ApolloClient({ | |
connectToDevTools: process.browser, | |
ssrMode: !process.browser, | |
link: new HttpLink({ | |
uri: 'https://api.graphcms.com/simple/v1/cjhdcwrb98if90109o4pzawaq' | |
}), |
This file contains hidden or 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 { Route, Switch } from 'react-router-dom' | |
import Home from './Pages/Home' | |
import Speakers from './Pages/Speakers' | |
import Speaker from './Pages/Speaker' | |
import Tags from './Pages/Tags' | |
import Tag from './Pages/Tag' | |
import Favorites from './Pages/Favorites' | |
import './Utils/global-styles' | |
import './Utils/icons' |
This file contains hidden or 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
res.send(`<!doctype html> | |
<html lang="en" ${helmet.htmlAttributes.toString()}> | |
<head> | |
${helmet.title.toString()} | |
${helmet.meta.toString()} | |
${helmet.link.toString()} | |
${assets.client.css | |
? `<link rel="stylesheet" href="${assets.client.css}">` | |
: '' } | |
${process.env.NODE_ENV === 'production' |
This file contains hidden or 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 { ServerStyleSheet, ThemeProvider } from 'styled-components' | |
const sheet = new ServerStyleSheet() | |
// When the app is rendered collect the styles that are used inside it | |
const markup = renderToString(sheet.collectStyles(<Root />)) | |
// Generate all the style tags so they can be rendered into the page | |
const styleTags = sheet.getStyleTags() |
This file contains hidden or 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 Root = () => ( | |
<ThemeProvider theme={theme}> | |
<StaticRouter location={req.url} context={context}> | |
<App /> | |
</StaticRouter> | |
</ThemeProvider> | |
) |
This file contains hidden or 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 { Helmet } from 'react-helmet' | |
.... | |
const helmet = Helmet.renderStatic() | |
res.send(`<!doctype html> | |
<html lang="en" ${helmet.htmlAttributes.toString()}> | |
<head> | |
${helmet.title.toString()} |
This file contains hidden or 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 fontawesome from '@fortawesome/fontawesome' | |
.... | |
res.send(`<!doctype html> | |
<html lang="en" ${helmet.htmlAttributes.toString()}> | |
<head> | |
${assets.client.css | |
? `<link rel="stylesheet" href="${assets.client.css}">` |
This file contains hidden or 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 fontawesome from '@fortawesome/fontawesome' | |
import faTimes from '@fortawesome/fontawesome-free-solid/faTimes' | |
import faSearch from '@fortawesome/fontawesome-free-solid/faSearch' | |
fontawesome.config = { | |
autoAddCss: false | |
} | |
fontawesome.library.add(faSearch, faTimes) |