An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

# useMath

React hook for auto-rendering math content in the specified react node.

![screenshot](https://user-images.githubusercontent.com/4902438/50361018-9e82cf80-057b-11e9-98f6-0581b0d5d9dd.png)

```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.