Skip to content

A React component to toggle self-documenting code in UI frameworks.

Notifications You must be signed in to change notification settings

bilo-io/react-code-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-code-demo

This component displays React code that can be toggled, as a way of showing/hiding documentation. In particular, it is designed to behave in a way that is self-documenting. As such, whenever your code changes, the documentation reflects that.

Installation

npm install react-code-demo

Usage

import React from 'react'
import CodeView from 'react-code-demo'

export default class MyComponent extends React.Component {
    componentDidMount() {
        this.setState({ browser: detectBrowser() })
    }
    render() {
        const customComponent = <div>
            <h1>Hello, this is my component</h1>
            <div>
        </div>

        return (
            <CodeView code={ customCompoent } title={'optional title'} />
        )
    }
}

About

A React component to toggle self-documenting code in UI frameworks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published