Skip to content

Instantly share code, notes, and snippets.

View ibare's full-sized avatar
😃
I'm happy!!

Kim Mintae ibare

😃
I'm happy!!
  • WoowaBros
  • seoul, korea
View GitHub Profile
@ibare
ibare / app.js
Last active July 4, 2023 15:36
Tiny Redux
import { createStore, actionCreator } from "./redux-middleware";
function reducer(state = {}, { type, payload }) {
switch (type) {
case "init":
return {
...state,
count: payload.count
};
case "inc":
@ibare
ibare / App.js
Created September 10, 2020 13:09
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
@ibare
ibare / App.js
Last active July 4, 2023 15:37
Custom React
/* @jsx createElement */
import { createElement, render, Component } from './react.js';
class Text extends Component {
render() {
return (
<span>L({this.props.v})</span>
);
}
}
import { createStore, actionCreator } from "./tiny-redux";
function reducer(state = {}, { type, payload }) {
switch (type) {
case "init":
return {
...state,
count: payload.count
};
case "inc":
@ibare
ibare / actionType.js
Last active June 10, 2020 12:48
Redux 시작하기
export const UPDATE_FONT_SIZE = "update font size";
export const UPDATE_COLOR = "update color";
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));
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)
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')
];
@ibare
ibare / request-async-task-status.tsx
Created June 4, 2019 08:46
비동기 작업 요청 상태
const OrderList: React.FC<IProps> = props => {
const [request, completeRequest] = React.useState(false);
const [requestId, upddateRequestId] = React.useState(0);
if (request && checkCompleteTask(props.asyncTasks, requestId)) {
completeRequest(false);
}
React.useEffect(() => {
const {
@ibare
ibare / BlinkingCircle.tsx
Created April 26, 2019 08:56
깜빡이는 원
import * as React from "react"
import { Frame, useCycle } from "framer"
// Open Preview (CMD + P)
// API Reference: https://www.framer.com/api
export function BlinkingCircle() {
const [animate, cycle] = useCycle(
{ backgroundColor: "#ff2020" },
{ backgroundColor: "#ffbc20" }