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 { useState } from 'react' | |
| import { TodoProvider } from './TodoContext/TodoProvider' | |
| import TodoInput from './TodoContext/TodoInput' | |
| import TodoList from './TodoContext/TodoList' | |
| import StatusBar from './StatusBar' | |
| function App() { | |
| return ( | |
| <TodoProvider> | |
| <TodoInput /> |
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'; | |
| import ClassClock from './ClassClock'; | |
| import FunctionClock from './FunctionClock'; | |
| import ClassTodo from './ClassTodo'; | |
| import FunctionTodo from './FunctionTodo'; | |
| function App() { | |
| const [visibleClock, setVisibleClock] = useState(true); | |
| const [clockColor, setClockColor] = useState('black'); | |
| const toggleClock = () => setVisibleClock(!visibleClock); |
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 { createStore, actionCreator } from "./redux-middleware"; | |
| function reducer(state = {}, { type, payload }) { | |
| switch (type) { | |
| case "init": | |
| return { | |
| ...state, | |
| count: payload.count | |
| }; | |
| case "inc": |
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"; | |
| const SessionItem = ({ title }) => <li>{title}</li>; | |
| const App = (props) => { | |
| const [displayOrder, toggleDisplayOrder] = React.useState("ASC"); | |
| const { sessionList } = props.store; | |
| const orderedSessionList = sessionList.map((session, i) => ({ | |
| ...session, | |
| order: i |
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
| /* @jsx createElement */ | |
| import { createElement, render, Component } from './react.js'; | |
| class Text extends Component { | |
| render() { | |
| return ( | |
| <span>L({this.props.v})</span> | |
| ); | |
| } | |
| } |
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 { createStore, actionCreator } from "./tiny-redux"; | |
| function reducer(state = {}, { type, payload }) { | |
| switch (type) { | |
| case "init": | |
| return { | |
| ...state, | |
| count: payload.count | |
| }; | |
| case "inc": |
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
| export const UPDATE_FONT_SIZE = "update font size"; | |
| export const UPDATE_COLOR = "update color"; |
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
| Promise.resolve() | |
| .then(() => { | |
| return 'OK' | |
| }) | |
| .then(a => `${a} ${Date.now()}`) | |
| .then(b => new Promise((resolve) => { | |
| setTimeout(() => resolve(`${b} + delay`), 1000); | |
| })) | |
| .then(out => console.log(out)) | |
| .catch(e => console.error(e)); |
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 * as React from "react" | |
| import { Frame, useCycle, useMotionValue, useTransform } from "framer" | |
| // Open Preview (CMD + P) | |
| // API Reference: https://www.framer.com/api | |
| export function MotionAndTransform() { | |
| const yPosition = useMotionValue(200) | |
| const xPosition = useMotionValue(0) | |
| const doubleXPosition = useTransform(xPosition, v => v * 2) |
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
| function random(max) { | |
| return Math.floor(Math.random()*max); | |
| } | |
| const startButton = document.querySelector('#start'); | |
| const boxes = [ | |
| document.querySelector('#b1'), | |
| document.querySelector('#b2'), | |
| document.querySelector('#b3') | |
| ]; |
NewerOlder