react-formula-beautifier
React wrapper for mathjax
Quickstart: How to use?
(a) Install library
npm install react-formula-beautifier --save
(b) Add mathjax for your current project(add script tag to your index.html file)
<script
type="text/javascript"
src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full">
</script>
(c) Done you are awesome!
Example Usage
;; { superprops; thisstate = currentFormula: propsdefaultFormula || 'x_1 + (x_2)^2' ; } this; { return <div className="formula-block"> <input defaultValue=thisstatecurrentFormula placeholder="Enter formula" onChange=thisupdateCurrentFormula /> <TeX value=thisstatecurrentFormula /> </div> ; } ;
EXAMPLE
You can also find more examples hereISSUES
Feel free to open issuesNote:
instead of adding mathjax to index.html file you can also use imports-loader in your React Component
;