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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server side rendering. #37

Open
DylanPiercey opened this issue Apr 28, 2016 · 3 comments
Open

Server side rendering. #37

DylanPiercey opened this issue Apr 28, 2016 · 3 comments

Comments

@DylanPiercey
Copy link

DylanPiercey commented Apr 28, 2016

Can you use https://github.com/panosoft/node-chartist to achieve server side rendering with chartist?

Might not work since node-chartist is async but I'd love an isomorphic charting solution 馃槥.

@DylanPiercey
Copy link
Author

I don't currently have time do attempt this but another option would be to try https://github.com/Olical/react-faux-dom.

@fraserxu
Copy link
Owner

Hi @DylanPiercey Thanks for the suggestion here, Sorry I'm a little busy at work recently and don't have time to look at this.

I'll take some time to look into this probably this weekend.

@crobinson42
Copy link

@DylanPiercey Have you had a chance to demo SSR w/ react-chartist?

I just did a quick test with the example code from the repo and the response is:

<div><div class="ct-chart ct-octave"></div></div>

with this code:

var Pie = require('./Server/Chart');

      var ComponentFactory = React.createFactory(Pie);
      var html = ReactDOMServer.renderToStaticMarkup( ComponentFactory() );

This is because the first revolution of the DOM render is still processing.. this is due to the logic being used in componentDidMount, which waits for the DOM to mount before it applies the chart. In the server-side environment, react doesn't go past the first render cycle and immediately returns the first rendered output.

So, the answer to this is No. You cannot achieve server side render, with the current npm package.

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

3 participants