1. Add @storybook/react

npm i --save-dev @storybook/react

2. Add react, react-dom, and babel-core

npm i --save react react-dom

npm i --save-dev babel-core

3. Then add the following NPM script to your package json in order to start the storybook later in this guide

{

  "scripts": {

     "storybook": "start-storybook -p 9001 -c .storybook"

   }

}

4. Create the config file

To do that, simply create a file at .storybook/config.js with the following content:

import { configure } from '@storybook/react'; 

function loadStories() { 
  require('../stories/index.js'); // You can require as many stories as you need.
}
configure(loadStories, module);

5. Write your stories

Now you can write some stories inside the ../stories/index.js file, like this:

import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import Button from '../components/Button'; storiesOf('Button', module)
.add('with text', () => (
<Button onClick={action('clicked')}>Hello Button</Button>
))
.add('with some emoji', () => (
<Button onClick={action('clicked')}><span role="img" aria-label="so cool">

手动建立storybook的更多相关文章

  1. 手动建立mapping以及增加属性

    只能创建index时手动建立mapping,或者新增field mapping,但是不能update field mapping 1.手动建立mappingPUT /website{ "ma ...

  2. Oracle XE手动建立数据库实例

    参考资料为: [Oracle XE系列之三]使用OMF方式手工创建Oracle XE数据库 - 王立夫 - 博客园http://www.cnblogs.com/opfo/p/5056122.html ...

  3. Quarter square 查找表乘法器,手动建立rom

    建立一个C的范围为0~255,内容是(C)2/4的查表 占用256个存储空间,但可以计算出+-127的两个数之积.传统算法需要至少127×127个存储空间. 查找表模块的建立: module lut_ ...

  4. keystone 手动建立租户,用户,角色,服务,端口

    建立租户: root@cloud:~# keystone tenant-create --name=admin WARNING: Bypassing authentication using a to ...

  5. 手动建立数据库连接的BaseDAO

    package com.chinasoft.julong.dao; import java.sql.Connection; import java.sql.DriverManager; import ...

  6. Linux中yum手动安装、手动建立仓库文件夹关联实现关联包自动安装、yum相关命令使用

               yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器.基於RPM包管理,能够从指 ...

  7. LINUX 手动建立SWAP文件及删除

    原文:http://blog.itpub.net/7728585/viewspace-670175/ 1. 确定swap文件的大小,单位为M.将该值乘以1024得到块大小.例如,64MB的swap文件 ...

  8. 【转】LINUX 手动建立SWAP文件及删除

    如何在红帽 企业版Linux系统中添加swap文件? 解决方法: 1. 确定swap文件的大小,单位为M.将该值乘以1024得到块大小.例如,64MB的swap文件的块大小是65536. 2. 在ro ...

  9. Ubuntu14.04下手动建立快捷方式

    先在桌面创建一个文件:文件内容如下 [Desktop Entry]Encoding=UTF-8Name=eclipseComment=eclipse ideExec=/home/mars/eclips ...

随机推荐

  1. poj 1329(已知三点求外接圆方程.)

    Circle Through Three Points Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3766   Acce ...

  2. csu1811(树上启发式合并)

    csu1811 题意 给定一棵树,每个节点有颜色,每次仅删掉第 \(i\) 条边 \((a_i, b_i)\) ,得到两颗树,问两颗树节点的颜色集合的交集. 分析 转化一下,即所求答案为每次删掉 \( ...

  3. 洛谷——P2862 [USACO06JAN]把牛Corral the Cows

    P2862 [USACO06JAN]把牛Corral the Cows 题目描述 Farmer John wishes to build a corral for his cows. Being fi ...

  4. Missing Ranges -- LeetCode

    Given a sorted integer array where the range of elements are [lower, upper] inclusive, return its mi ...

  5. Java判断中文字符

    package com.jsoft.test; import java.util.regex.Pattern; /** * 判断中文字符 * * @author jim * @date 2017-12 ...

  6. delphi程序全屏显示无标题栏覆盖整个屏幕

    delphi 简单实现程序全屏显示无标题栏,覆盖整个屏幕,这个在做工控机或屏保时有用的,具体代码如下,感兴趣的朋友可以参考下哈 delphi 程序全屏显示无标题栏,覆盖整个屏幕,这个在做工控机或屏保时 ...

  7. http://jingyan.baidu.com/article/0eb457e5208cbb03f0a9054c.html

    http://jingyan.baidu.com/article/0eb457e5208cbb03f0a9054c.html

  8. Hive图形化界面客户端

    通过JDBC连接HiveServer2的图形界面工具,包括:SQuirrel SQL Client.Oracle SQL Developer以及DbVisualizer SQuirrel SQL Cl ...

  9. perl学习笔记一

    标量数据 标量:数字.字符.可以存储在标量变量中也可以从文件和设备中读取. 数字:所有数字内部格式相同——双精度浮点数. 浮点数直接量:程序员在程序中直接键入的数字. 整数直接量:6129804028 ...

  10. HUNAN Interesting Integers(爆力枚举)

    Undoubtedly you know of the Fibonacci numbers. Starting with F1 = 1 and F2 = 1, every next number is ...