Gatsby Layout Component is a great way to wrap your site with a consistent header and footer
Install necessary NPM packages
import React from 'react' | |
const Index = (props) => { | |
return ( | |
<div> | |
<h1>your nav here</h1> | |
{props.children} | |
<h1>your footer here</h1> | |
</div> | |
) |
Gatsby Layout Component is a great way to wrap your site with a consistent header and footer
Install necessary NPM packages
import React, { createContext, useContext, useReducer } from "react"; | |
var StoreContext = createContext(); | |
var initialState = { | |
count: 0, | |
}; | |
var reducer = (state, action) => { | |
switch (action.type) { |
import React, { useState, createContext, useContext } from "react"; | |
import { uuid } from "uuidv4"; | |
var initialState = [ | |
{ | |
id: uuid(), | |
title: "Intro to HTML", | |
description: "Learn everything you need to know about html!", | |
duration: "1hr 5min", | |
}, |
// helpful article: | |
// https://dev.to/elisealcala/react-context-with-usereducer-and-typescript-4obm | |
import React, { createContext, useContext, useReducer } from "react"; | |
type IState = { | |
count: number; | |
message?: string; | |
}; |
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const { graphqlHTTP } = require('express-graphql'); | |
// build schema allows you to build your schema as a string literal, processed through | |
// then build schema converts it into a js object | |
// then use it in the "schema" property in the express graphql middleware | |
// alternatively you can create these schemas in object form using graphql's GraphQLObjectType, and types like GraphQLString, | |
// GraphQL object types act more like components with resolvers included |
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const jwt = require('jsonwebtoken'); | |
const app = express(); | |
app.use(bodyParser.json()); | |
const users = []; |