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

Suggestion: Add createElement export for dom #10

Open
DanTheMan827 opened this issue Feb 6, 2019 · 2 comments
Open

Suggestion: Add createElement export for dom #10

DanTheMan827 opened this issue Feb 6, 2019 · 2 comments

Comments

@DanTheMan827
Copy link
Contributor

webpack has the option for aliasing one module name with another, so you could alias react as jsx-render and use the default React.createElement function from the jsx loader

This would allow using the same components on the server and client side provided they're compatible enough

@alexrqs
Copy link
Owner

alexrqs commented Feb 13, 2019

Hey @DanTheMan827 is not a bad idea but will add a little bit of coupling one to webpack and other few but I'm open to evaluating it from a PR to the #8 that includes a work in progress for the server side rendering feature

@DanTheMan827
Copy link
Contributor Author

DanTheMan827 commented Feb 21, 2019

just for reference, I made a simple include file in my project with the following content that when added as an alias with webpack provides enough of the React functionality to not cause errors for basic stuff, I haven't tried any complex stuff though.

export { default as createElement, Fragment } from 'jsx-render'

by aliasing react to that include file, things like import * as React from 'react' work without any issues

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

2 participants