robinricard
Joined 12 years ago
Joined 12 years ago
You should also install language-reason and reason-refmt alongside it.
- You're just getting started with React? Use CRA[1], it is enough for most of the use cases people will ever need use React with. You may also want to consider Next.js[2] if you are looking to do a more website-like app using React components but that's all...
- You know how to setup js tooling (webpack, babel, react-router, redux, ...)? You may still want to use CRA because it is way easier to use anyway. But this time you know you can either eject to more fine-grained tooling tuning or do your thing independently if you want.
If you use a boilerplate at that point, that's because you understand the tooling behind it and CRA won't answer to the precise need covered in this boilerplate. Also you should be able to maintain it and make it evolve later (the more dependencies, the harder it will be...). So in that case, if you master all of those tools (can't say I do) and integrate them often with django, then maybe, this boilerplate could be for you...
In conclusion, this covers a very special need and I don't understand how this got on top of HN... It actually makes the React community look kind of bad (assuming some people upvote when they see React stuff, which I don't think is the case) because this does not seem to solve any of the problems people outside of the community are complaining about. So, if you are looking for an easy way to use React (that won't prevent you from plugging it to your django backend btw), just use CRA!
[1]: https://github.com/facebookincubator/create-react-app [2]: https://github.com/zeit/next.js/
learnapollo seems awesome too! I think that Apollo would benefit from this kind of documentation. You should definitely come and send a link on the Apollo's slack!
In general Graphcool is a great idea if you want to start fast with GraphQL (with any client).
This is a great initiative! I remember struggling to learn Relay, I love it though, used it in some toy apps and will use it in some upcoming projects that I have. However I have a few issues with Relay: the main one is that it overall discourages people from starting with GraphQL. From creating a Relay-compliant GraphQL server to adding it to your app, Relay forces you to good conventions that, unfortunately, requires you to learn about its concepts and makes it super difficult to ramp up fast.
For anyone interested in working with Relay and GraphQL in general, I would advise you to start first with just learning GraphQL, without Relay and its constraints. You'll see that much of the issues you may have with GraphQL may come from actually trying to comply to Relay. Once you are okay with GraphQL, then, you can move to learning Relay.
Finally, I want to insist on the fact that GraphQL is just a specified language that can be consumed by any client you need/want. Relay is made by Facebook, for Facebook, which is a cool thing but may be a bit too much for your simple app or may not be adapted if you are migrating a legacy app to GraphQL (which was my case). That's why you should take a look to alternative clients as well (Apollo [0] for instance ;-) )!
After that you can basically try anything, but at least you will know pretty much everything about what modern JS has to offer!
I would recommend starting with create react app [1]. I think it can be used with other libs than react as well, the thing is just a strong webpack + eslint preconfiguration so you don't have to worry about it.
The second snippet uses ES6 modules [2]. Babel actually transpiles those ES6 modules into CommonJS modules when used in a Node.js environment (which is the case with a build tool).
Since even IO.js doesn't support ES6 modules for now and you're likely to use a build tool in order to use babel, you shouldn't use ES6 modules in a build file.
[1]: http://www.commonjs.org/ [2]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...