github doczjs/docz v0.12.9

latest releases: v2.4.0, v2.3.3-alpha.0, v2.3.2-alpha.0...
5 years ago

Changelog

🐞  Bug Fixes

  • docz-theme-default: table margin bottom (36e322f)
  • docz-theme-default: use class inside playground (cecbea1) (closes #261)

🚀  Features

  • docz-theme-default: add style for hr component (5b24400)
  • docz-theme-default: hide playground editor by default (0ccda92)

Rendering class inside <Playground>

Now you can render classes inside playground just by declaring a class, like that:

import { Playground } from 'docz'

<Playground>
  {class Counter extends React.Component {
    constructor() {
      super()
      this.state = { count: 0 }
    }

    componentDidMount() {
      this.interval = setInterval(() => {
        this.setState(state => ({ count: state.count + 1 }))
      }, 1000)
    }

    componentWillUnmount() {
      clearInterval(this.interval)
    }

    render() {
      return (
        <center>
          <h3>
            {this.state.count}
          </h3>
        </center>
      )
    }
  }}
</Playground>

Don't miss a new docz release

NewReleases is sending notifications on new releases.