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
function Page({ stars }) { | |
return <div>Next stars: {stars}</div> | |
} | |
Page.getInitialProps = async (ctx) => { | |
const res = await fetch('https://api.github.com/repos/vercel/next.js') | |
const json = await res.json() | |
return { stars: json.stargazers_count } | |
} |
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
function Page({ data }) { | |
// Render data... | |
} | |
// This gets called on every request | |
export async function getServerSideProps() { | |
// Fetch data from external API | |
const res = await fetch(`https://.../data`) | |
const data = await res.json() |
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
// This function gets called at build time | |
export async function getStaticPaths() { | |
// Call an external API endpoint to get posts | |
const res = await fetch('https://.../posts') | |
const posts = await res.json() | |
// Get the paths we want to pre-render based on posts | |
const paths = posts.map((post) => `/posts/${post.id}`) | |
// We'll pre-render only these paths at build time. |
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
function Blog({ posts }) { | |
// Render posts... | |
} | |
// This function gets called at build time | |
export async function getStaticProps() { | |
// Call an external API endpoint to get posts | |
const res = await fetch('https://.../posts') | |
const posts = await res.json() |
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
function About() { | |
return <div>About</div> | |
} | |
export default About |
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
<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
android:width="24dp" | |
android:height="24dp" | |
android:viewportWidth="24.0" | |
android:viewportHeight="24.0"> | |
<!--standard icon--> | |
<path | |
android:fillAlpha="0.2" | |
android:fillColor="#FF000000" |
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
require 'support/schemas/projects/update' | |
RSpec.describe GraphqlsController, type: :controller do | |
let(:user) { create :user } | |
let!(:project) { create :project, user: user } | |
describe 'POST #create' do | |
let(:mutation) do | |
' | |
mutation($id: ID!, $title: String!) { |
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
npm install -g yarn |
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
<span>{{ message | uppercase }}</span> |
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
<span>{{ message | uppercase }}</span> |
NewerOlder