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

Remove blaze-html-templates #13

Open
jakobrosenberg opened this issue Sep 12, 2015 · 6 comments
Open

Remove blaze-html-templates #13

jakobrosenberg opened this issue Sep 12, 2015 · 6 comments

Comments

@jakobrosenberg
Copy link

Are there any benefits in using both React and Blaze? It increases the app size and feels less "clean".

@brandonmikeska
Copy link

I think it's just easier to maintain very long HTML static pages, and I think this project was just showing people you can mix both if you wanted to slowly convert your app.

I could be wrong though.

@AdamBrodzinski
Copy link
Owner

Great comments. When I first built it Blaze was required (pre 1.2) and I was very familiar with it (actually the React package didn't even exist then lol).

However 20/20 hindsight and with 1.2 here and React 0.14 almost here I think the best thing is to use the new 'stateless' components and paste in the HTML to the render method and do a find/replace to change class to className.

This allows you to remove Blaze and jQuery from the client which would drop download times.

As Brandon mentioned at the least it's a good example of how you can refactor a meteor app.

I would be happy to take a PR to convert the 'pages' to react 😃 I'm so swamped currently I won't be able to get to it for months. I think it would be best to leave this open for new users to see 👍

@AdamBrodzinski
Copy link
Owner

@jakobrosenberg @brandonmikeska - i'm aiming to close this issue by converting the blaze components to stateless components in an upcoming screencast. This might also be good to show people how to convert Blaze apps to React.

@joemaffei
Copy link

I just built a "Hello world" app in Meteor 1.3 using React. I removed blaze-html-templates and gave it a go. If I mounted my component directly to document.body, it would run fine. But I would get an error in the console if I tried to mount the component to a div. A quick look at the source showed that the div wasn't even there.

Reinstalling blaze-html-templates solved the problem.

@dschreij
Copy link

dschreij commented Jan 12, 2017

I had the exact same problem @joemaffei!

Removing blaze-html-templates caused the error

Uncaught Error: _registerComponent(...): Target container is not a DOM element.

And the div on which I mount the primary react component could not be found with document.getElementById().

So you could call this module a required dependency for meteor to run.

@JeremyIglehart
Copy link

The solution to this is to meteor add static-html - then your HTML will work the way you expect it to, and you won't have blaze anymore.

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

6 participants