How to set up React with Meteor?

烈酒焚心 提交于 2020-01-06 15:06:52

问题


I have started learning meteor and decided to use it with react. Since one month, I had issues about which packages I should use.

At the end of the day , I know I should use webpack for codesplitting, react-router since it promises much more compatibility with other stuff related to react and lastly I don t want server-side-rendering since it lacks many of the things I want in my application( in short responsiveness of my app ).

Anyway, I checked lots of repos on github and read many articles etc. Since first day , I still hate meteor + react because it s been very confusing to decide between different combinations of using packages.


Finally my question is about which of the packages for data I should use with my pack. So my pack consists of

  1. react
  2. react-dom
  3. react-router
  4. webpack
  5. babel

Which of the followings should I use to complete my pack.

  1. react-meteor-data
  2. react-mounter
  3. anything else ?

I don t really know how meteor bootstraps, how it handles data, how it passes data to react, why are there weird mixins used within many projects on github etc. I am really exhausted. I should start my project and finish. Still trying to figure out how meteor works and choose between those packages.


回答1:


If you're a beginner, I'd advise to use the following setup instead:

  • React. Install the npm package instead of what you find on Atmosphere, they're for an older version of Meteor, where npm support wasn't really a thing yet.
  • Flow Router integrates really well with Meteor, it's really straightforward to use. Provides reactive variables and even server-side rendering, that will come in handy later when optimize your app for SEO.
  • react-meteor-data is responsible for connecting Meteor and React. It provides the createComponent function that can turn Meteor subscriptions into React properties.
  • react-mounter from npm. Use it when you define Flow Router routes to mount your React components to the DOM.

That's the basics you'll need to make an awesome webapp with Meteor and React. :)

At the beginning I'd skip webpack. It's awesome, but can easily make your learning curve a bit too steep. You'll know when to switch to it.



来源:https://stackoverflow.com/questions/36890816/how-to-set-up-react-with-meteor

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!