/react-mathquill

React component wrapper for Mathquill

Primary LanguageJavaScriptMIT LicenseMIT

React component wrapper for Mathquill

npm version

Example

Link to an example

import React from 'react'
import MathQuill, { addStyles as addMathquillStyles } from 'react-mathquill'

// inserts the required css to the <head> block.
// You can skip this, if you want to do that by your self.
addMathquillStyles()

export default class App extends React.Component {
  constructor() {
    this.state = {
      latex: '\\frac{1}{\\sqrt{2}}\\cdot 2',
    }
  }

  render() {
    return (
      <MathQuill
        latex={this.state.latex} // Initial latex value for the input field
        onChange={mathField => {
          // Called everytime the input changes
          this.setState({ mathField.latex() })
        }}
      />
    )
  }
}