https://github.com/mdibyo/use-math
React hook for auto-rendering math content in the specified react node
https://github.com/mdibyo/use-math
Last synced: about 1 month ago
JSON representation
React hook for auto-rendering math content in the specified react node
- Host: GitHub
- URL: https://github.com/mdibyo/use-math
- Owner: mDibyo
- Created: 2018-12-21T09:31:27.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-21T19:58:55.000Z (over 7 years ago)
- Last Synced: 2025-08-17T21:47:53.995Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# useMath
React hook for auto-rendering math content in the specified react node.

```jsx
function MathDiv({ children }) {
const ref = React.createRef();
useMath(ref);
return
{children};
}
ReactDOM.render(
{"Math here: $$x = \\frac{1}{2}$$"},
document.getElementById('root'),
);
```
### Usage
```bash
npm install use-math
```
Then import
```js
import useMath from 'use-math';
```
## Introduction
Under the hood, `useMath` uses [KaTeX](https://github.com/KaTeX/KaTeX) to render the math content.