Skip to content

Instantly share code, notes, and snippets.

View yukikim's full-sized avatar
😵
It is busy

takayuki_kimura yukikim

😵
It is busy
View GitHub Profile
@yukikim
yukikim / index.html
Created July 19, 2019 06:01
Test Chart 2
<canvas id="myChart" width="400" height="400"></canvas>
@yukikim
yukikim / index.html
Created July 19, 2019 06:14
Test Chart 3
<canvas id="myChart" width="400" height="400"></canvas>
@yukikim
yukikim / info.md
Last active September 20, 2019 01:03
CentOS7 ポート開放について

利用可能サービスの確認

$ firewall-cmd --list-all

ポート開放

開放しているポートの確認

  • $ firewall-cmd --list-ports --zone=public

ポート開放

@yukikim
yukikim / info.md
Last active September 20, 2019 02:28
nginxインストール CentOS7
@yukikim
yukikim / sample.tsx
Created November 10, 2024 18:31
[tsx]childrenを取る場合
//React.ReactNodeの指定
// Containerのpropsの型を定義します
type ContainerProps = {
title: string
children: React.ReactNode
}
// Reactコンポーネントの型付けに関しては、以下もご参照ください
// https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/function_components/
@yukikim
yukikim / sample.tsx
Created November 10, 2024 18:39
[tsx]sample_useReducer
import { useReducer } from 'react'
// reducerが受け取るactionの型を定義します
type Action = 'DECREMENT' | 'INCREMENT' | 'DOUBLE' | 'RESET'
// 現在の状態とactionにもとづいて次の状態を返します
const reducer = (currentCount: number, action: Action) => {
switch (action) {
case 'INCREMENT':
return currentCount + 1
@yukikim
yukikim / state.tsx
Last active November 10, 2024 19:22
[tsx]useState を使った簡単な条件分岐
import React, { useState } from 'react';
// それぞれのコンポーネント
const ComponentA: React.FC = () => <div>Component A</div>;
const ComponentB: React.FC = () => <div>Component B</div>;
const ComponentC: React.FC = () => <div>Component C</div>;
const MyComponent: React.FC = () => {
// ステートを定義
const [currentComponent, setCurrentComponent] = useState<string>('A');
@yukikim
yukikim / use_reduser.tsx
Created November 10, 2024 19:23
[tsx]useReducer を使ったより複雑な状態管理
import React, { useReducer } from 'react';
// それぞれのコンポーネント
const ComponentA: React.FC = () => <div>Component A</div>;
const ComponentB: React.FC = () => <div>Component B</div>;
const ComponentC: React.FC = () => <div>Component C</div>;
// reducer のアクション型
type Action = { type: 'showA' } | { type: 'showB' } | { type: 'showC' };
@yukikim
yukikim / map.tsx
Last active November 10, 2024 19:29
[tsx]配列を map でレンダリング
import React from 'react';
interface Item {
id: number;
name: string;
}
const MyComponent: React.FC = () => {
// 配列データを定義
const items: Item[] = [
@yukikim
yukikim / Sample.tsx
Last active November 10, 2024 23:55
[tsx]子コンポーネントから親コンポーネントへ
//### 親コンポーネント
import React, { useState } from 'react';
import ChildComponent from './ChildComponent';
const ParentComponent: React.FC = () => {
const [data, setData] = useState<string>('');
const handleDataFromChild = (childData: string) => {