View final.tsx
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
import React from 'react'; | |
interface ThemeProps { | |
color: string; | |
backgroundColor: string; | |
} | |
interface Theme { | |
theme: ThemeProps; | |
} |
View newContext.tsx
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
import React from 'react'; | |
interface ThemeProps { | |
color: string; | |
backgroundColor: string; | |
} | |
interface Theme { | |
theme: ThemeProps; | |
} |
View ThemeContext.tsx
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
import React from 'react'; | |
enum Actions { | |
LIGHT = 'light', | |
DARK = 'dark', | |
BROWN = 'brown', | |
} | |
interface ThemeProps { | |
color: string; |
View index.js
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
import React from 'react' | |
import {Rule} from '@cesium133/forgjs' | |
interface Validation { | |
rule: any | |
message: string | |
} | |
const useValidation = (value: string, validation: Validation) => { | |
const [validity, setValid] = React.useState({valid: true, message: ''}) |
View index.js
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
const {gql} = require('apollo-server'); | |
const typeDefs = gql` | |
extend type Query { | |
book(id: ID!): Book | |
books: [Book] | |
} | |
type Book { | |
id: ID! | |
title: String | |
author: Author |
View index.js
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
const {gql} = require('apollo-server'); | |
const typeDefs = gql` | |
extend type Query { | |
author(id: ID!): Author | |
authors: [Author] | |
} | |
type Author { | |
id: ID! | |
name: String | |
surname: String |
View index.js
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
const {ApolloServer} = require('apollo-server'); | |
const server = new ApolloServer({ | |
modules: [ | |
require('./modules/author'), | |
require('./modules/books') | |
] | |
}) | |
server | |
.listen() | |
.then(({url}) => console.log(`server is running at ${url}`)); |
View todoRef.tsx
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
import React, { useState, useReducer, useRef } from "react"; | |
const todoListReducer = ( | |
state: string[], | |
action: { type: string; value: string } | |
) => { | |
switch (action.type) { | |
case "ADD": | |
return [...state, action.value]; | |
case "REMOVE": |
NewerOlder