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
| // REF: https://medium.com/with-orus/the-5-commandments-of-clean-error-handling-in-typescript-93a9cbdf1af5 | |
| // baseError | |
| type Jsonable = string | number | boolean | null | undefined | readonly Jsonable[] | { readonly [key: string]: Jsonable } | { toJSON(): Jsonable } | |
| export class BaseError extends Error { | |
| public readonly context?: Jsonable | |
| constructor(message: string, options: { error?: Error, context?: Jsonable } = {}) { | |
| const { cause, context } = options |
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 { GraphQLServer } from 'graphql-yoga'; | |
| // Scalar types - String, Boolean, Int, Float, ID, | |
| // Type Definitions (schema) | |
| const typeDefs = ` | |
| type Query { | |
| greeting(name: String, job: String): String! | |
| me: User! | |
| post: Post! |
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, { Component } from 'react'; | |
| import Navigation from './Navigation'; | |
| import styled, { ThemeProvider, createGlobalStyle } from 'styled-components'; | |
| const theme = { | |
| red: '#FF0000', | |
| black: '#393939', | |
| maxWidth: '1300px', | |
| bs: '0 12px 24px 0 rgba(0, 0, 0, 0.09)', | |
| }; |
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 styled from 'styled-components' | |
| import CartStyles from './styles/CartStyles'; | |
| const Cart = () => ( | |
| <CartStyles> | |
| <div className="intro"> | |
| <p>You Have 3 items in your cart.</p> | |
| </div> | |
| <ul> |
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 styled from 'styled-components'; | |
| const HeroWrapper = styled.div` | |
| width: 100%; | |
| min-hieght: 40vh; | |
| background: ${props => props.theme.red}; // Using a theme property. | |
| .standard-div { | |
| text-transform: uppercase; |
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, { useState } from 'react'; | |
| const todo = props => { | |
| const [userState, setUserState] = useState({ | |
| userName: '', | |
| userList: [], | |
| }); | |
| const inputChangeHandler = event => { | |
| setUserState({ |