an odd fellow

仕事のメモ

2018-07-13から1日間の記事一覧

関数の引数にスプレッド構文を使った場合

背景 React書いていると以下のような...propsのような記述がたまに見られるが、どういう振る舞いになるのか少し混乱したから整理する。 const DeleteButton = ({className, ...props}) => ( <span className={[style.root, className].join(' ')} {...props}> <TrashCanIcon /> <Baloon>削除する</Baloon> </span> ); スプレッド構文 ドットを3つつなげたこれはスプレ…

storybookに階層構造を追加する

背景 デフォルトでは1階層しかパスが切れない。 例えばAtomsのButton、MoleculesのFormがあったとして、理想的には以下のように整理したい。 Atoms Button with text with some emoji Molecules Form ContactForm MailAddressForm しかしデフォルトでは以下…