Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 1.24 KB

README.md

File metadata and controls

56 lines (40 loc) · 1.24 KB

simple-react-editor

A simple stackoverflow inspired editor.

NPM JavaScript Style Guide

Install

npm install --save simple-react-editor

Usage

import React, { Component } from 'react';

import SimplexEditor from 'simple-react-editor';

class Example extends Component {
  addArticleToState = value => {
    this.setState({ article: value });
  };
  render() {
    return <SimplexEditor getArticle={this.AddArticleToState} />;
  }
}

Update functionality

if you want to insert html content into the editor for editing purpose

import React, { Component } from 'react';

import SimplexEditor from 'simple-react-editor';

class Example extends Component {
  addArticleToState = value => {
    this.setState({ article: value });
  };

  htmlBody = `
  <h1>Hello World</h1>
  <p>We choose to fight because you need to be recognized</p>
  `

  render() {
    return <SimplexEditor getArticle={this.AddArticleToState} content={this.htmlBody}/>;
  }
}

License

MIT © truestbyheart