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

Replaces syntax to be compatible with vanilla node. #4

Merged
merged 1 commit into from
Feb 24, 2015

Conversation

adri
Copy link
Contributor

@adri adri commented Feb 21, 2015

Thank you for this library. When trying it out I noticed that I couldn't use it without compiling JSX etc.

Since I don't use webpack for the nodejs part, I replaced the JSX, destruct assignment and arrow functions.

@adri adri force-pushed the vanilla-node-compatibility branch from f9926af to 0eba775 Compare February 21, 2015 13:56
@ericclemmons
Copy link
Owner

@adri Thanks for this! I'll put this all into a release today.

I'm also determining how to make the need for react-router optional to avoid file-size bloat...

@jesseskinner
Copy link

+1 on the optional react-router. I'm using page.js in my current project.

@ericclemmons
Copy link
Owner

I'd be curious about seeing an example! I assume you just do a React.render(routeEntryPointComponent, 'app') for each route?

But yes, react-router is huge, so I need to figure out how peer-dependencies would work...

@ericclemmons
Copy link
Owner

Same goes for react. This library should be using the version your project has installed.

@jesseskinner
Copy link

Right now my render function looks like this. I have a controller for each route that gets the handler and the state (handler props) and calls the render callback below. I plan to move to using react-resolver to resolve the user requirement of the app component, and ideally to replace the controllers too.

router.render(function (handler, state) {
    var handlerElement = handler && React.createElement(handler, state);

    if (window.console && window.console.log) {
        console.log('[render]', handler && handler.displayName, state);
    }

    var userState = UserStore.getState();

    var app = React.createElement(Template, {
        // app state
        user: userState && userState.user

    }, handlerElement);

    React.render(app, document.getElementById('main'));
});

@adri adri force-pushed the vanilla-node-compatibility branch from 0eba775 to d84b51a Compare February 21, 2015 17:19
ericclemmons added a commit that referenced this pull request Feb 24, 2015
Replaces syntax to be compatible with vanilla node.
@ericclemmons ericclemmons merged commit 8f10706 into ericclemmons:master Feb 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants