Skip to content

Instantly share code, notes, and snippets.

View kenmori's full-sized avatar
🏠
Working from home

KenjiMorita kenmori

🏠
Working from home
View GitHub Profile
@kenmori
kenmori / childrenが合ったらさらに再帰処理.md
Last active December 27, 2019 11:24
TypeScript「Recursive processing if children are a in parent」parentの中にchildrenがaったらさらに再帰処理

TypeScript「Recursive processing if children are a in parent」parentの中にchildrenがあったらさらに再帰処理

type is here.

type Group = {
id: number;
value: string;
parentId: number;
children: Group[];
@kenmori
kenmori / Uncaught Error: Rendered fewer hooks than expected.md
Created December 25, 2019 22:58
解決【React】Uncaught Error: Rendered fewer hooks than expected. This may be caused by an accidental early return statement.」

解決【React】Uncaught Error: Rendered fewer hooks than expected. This may be caused by an accidental early return statement.」

from

const Contents = (props: ContentsProps) => {
    return (
        <div key={props.title}>
            {props.contents.map( // here!!!
@kenmori
kenmori / vscodevim-dosent-work.md
Last active December 14, 2019 00:21
vscodevim suddenly stops working。vscodevim(1.12.2)でバックスペース削除ができなくなる問題

vscodevim suddenly stops working。vscodevim(1.12.2)でバックスペース削除ができなくなる問題

aboutme/twitter

Do you want to solve it temporarily?(とりあえず早く開発しなくてはいけないのでサックと解決したい方)

  • vscodevimの拡張機能をuninstall
@kenmori
kenmori / styled-component-typescdript-react-create-app.md
Last active September 9, 2020 21:37
styled-component-typescdript-react-create-appでreset-css

styled-component-TypeScript-react-create-app(CRA)でreset-css(リセットCSS)

CRAでstyled-componentを導入し、cssをreset(リセットCSS)する方法

地味に記事がなかったので

@bukotsunikki

やること

  • Themeを入れる
@kenmori
kenmori / まだまだTypeScript.md
Last active December 1, 2019 08:15
まだまだTypeScript

まだまだTypeScript

Recordを使って型を一括変換

type Obj = {
    name: string
    age: number
}
@kenmori
kenmori / nullishcoalescing.md
Last active June 21, 2021 08:43
【TypeScript 3.7】nullish coalescing opearatorとは(読み方)

TypeScript 3.7 nullish coalescing opearatorとは

nullish coalescing opearatorの読み方

  • ヌリッシュコアレシングオペレーター
@kenmori
kenmori / 型定義がない自動生成したいTypeScript_SwaggerSwagger.ymlからschema.d.tsを生成する.md
Last active November 24, 2019 08:10
【型定義がない!自動生成したい!TypeScript x Swagger】Swagger.ymlからschema.d.tsを生成する

npx @manifoldco/swagger-to-ts swagger.yml --wrapper "declare namespace API" --output schema.d.ts

@kenmori
kenmori / gist:918016d8395c83d633b73ac19335bb1f
Last active August 31, 2021 14:33
【GraphQL x TypeScript】初心者向けFragmentの使い方。考え方

【GraphQL x TypeScript】初心者向けFragmentの使い方。考え方

Fragmentの使い方についてあまり記事がなかったので書きました。

どこかどういう役割で記述されているかを理解することだなと思いました。

(onって何???とかで調べてもないので)

@kenmori
kenmori / gist:a1d6596adaf3fcc8929827f435453009
Last active November 14, 2019 12:44
【GraphQL x TypeScript】Fragmentで返すデータ型をちゃんと絞り込まないとUnion型をoperation時に大変になります

【GraphQL x TypeScript】Fragmentで返すデータ型をちゃんと絞り込まないとUnion型をoperation時に大変になります

graphql-codegen で型定義を生成した後、大変です。 queryを作る際にFragmentを適切にすればその型が手に入るので、 page側で使いたい型を絞り混んで生成して型付けしたいですね。苦労しましたので書く

@kenmori
kenmori / Function to generate and download PDF as it is by converting components into images once with react.md
Last active January 23, 2023 10:33
Function to generate and download PDF as it is by converting components into images once with react

Function to generate and download PDF as it is by converting components into images once with react

Overview

  • reactでコンポーネントを一回画像にしてそのままPDF生成してダウンロードする機能
  • react-pdfは使わない
  • コンポーネントを画像にしてその画像をpdfとして出力する方法