Sunday, 2 April 2017

Render React ES6 to String for Express

I've coded an React Application in ES6 style, all my Components are build like the following:

import React, { Component } from 'react';

class Test extends Component {
    render() {
        return (
            <div className="testDiv">
                Hello Word
            </div>
        )
    }
}

export default Test;

This website is running via the default configuration via "npm start" at port 3000.

Furthermore I've an nodeJS application with an API via expressJS on port 8080. Now I want to create an single route to express where I can render the React application and deliver the HTML String back to the client. What's the best way to do this ? I'm new to React development, hope somebody can help.



via hengel28

No comments:

Post a Comment