debashisbarman / hello-story

This is a Hello, world! implementation of React Storybook.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hello-story

This is a Hello, world! implementation of React Storybook.

Storybook is a user interface development environment and playground for UI components.

Setup

  1. Install @storybook/react.
npm install @storybook/react --save-dev
  1. Add a npm script.
{
  "scripts": {
    "storybook": "start-storybook"
  }
}
  1. Configure Storybook in .storybook/config.js.
import { configure } from '@storybook/react';

function loadStories() {
  // load stories here...
  require('../src/stories/index');
}

configure(loadStories, module);
  1. Write stories in .src/stories/index.js.
import React from 'react';
import { storiesOf } from '@storybook/react';
import HelloWorld from '../components/HelloWorld';

storiesOf('HelloWorld', module)
  .add('with no content', () => <HelloWorld />)
  .add('with content', () => <HelloWorld content="Goodbye, World!" />);
  1. Run Storybook.
npm run storybook

This app is bootstrapped with React Kathamo. 😉

About

This is a Hello, world! implementation of React Storybook.


Languages

Language:JavaScript 91.2%Language:HTML 7.8%Language:CSS 0.9%