Skip to content

Instantly share code, notes, and snippets.

View takanorip's full-sized avatar
🍣
sushi

takanorip takanorip

🍣
sushi
View GitHub Profile
<link rel="preload" as="font" type="font/woff2" href="fonts/font.woff2" crossorigin="anonymous">
@takanorip
takanorip / OFL.css
Last active December 6, 2018 08:28
/*
* "InuFont" licensed under the SIL Open Font License
* https://www.hogehoge.com/(配布元のURL)
*/
@font-face {
font-family: 'Fuga';
src: url('Fuga.woff2') format('woff2');
font-weight: normal;
font-style: normal;
}
/*
* Copyright © [yyyy] [配布者の名前]
* http://www.hogehoge.com/(配布元のURL)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
query UserData {
me {
name
friends {
name
}
}
}
{
"me": {
"name": "takanori",
"friends": [
{
"name": "taro"
},
{
"name": "noriko"
}
import gql from "graphql-tag";
import { Query } from "react-apollo";
const GET_DOGS = gql`
{
dogs {
id
breed
}
}
<script>
window.__APOLLO_STATE__ = client.extract();
</script>
const client = new ApolloClient({
cache: new InMemoryCache().restore(window.__APOLLO_STATE__),
link,
});
// react-router v4 を想定したサンプルですが
// その他のルーターでも動作します
import { ApolloProvider, getDataFromTree } from 'react-apollo';
import { ApolloClient } from 'apollo-client';
import { createHttpLink } from 'apollo-link-http';
import Express from 'express';
import { StaticRouter } from 'react-router';
import { InMemoryCache } from "apollo-cache-inmemory";
import { Route, Switch } from 'react-router';
import { Link } from 'react-router-dom';
import React from 'react';
import routes from './routes';
const Layout = () =>
<div>
<nav>
<ul>