Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React Hotloading issues. #7

Open
HaoZeke opened this issue Dec 2, 2017 · 0 comments
Open

React Hotloading issues. #7

HaoZeke opened this issue Dec 2, 2017 · 0 comments

Comments

@HaoZeke
Copy link

HaoZeke commented Dec 2, 2017

Working with webpack HMR proxied through browsersync and the following config, I get the right formatting, however as I change the files, I require a full page refresh to get the equations..

import React from 'react';
import {render} from 'react-dom';
import ReactMarkdown from 'react-markdown';
import mdit from 'markdown-it';

const singleton = (creator) => {
  let obj;
  return () => obj || (obj = creator());
};


const md = singleton(() =>
  mdit({html: true, linkify: true})
  .use(require('markdown-it-mathjax')())
);

const input = '# Math Rulez! \n  $$\\sqrt{3x-1}+(1+x)^2 \\frac{23}{3}$$';

var rs = md().render(input);

function createMarkup() {
  return {__html: rs };
}

class App extends React.Component {
  render () {
    return <div dangerouslySetInnerHTML={createMarkup()} />;
  }
}

render(<App/>, document.getElementById('react'));

if (module.hot) {
  module.hot.accept();
}

Is this normal behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant