News for hackers. Stuff that matters.
Re:Django 2.1 released by johnthedebs on Wednesday August 01, 2018 @11:42AM (#17663529)
Not OP, but I've also been using Django for (more than) my whole career and I use React on the frontend.

If you're curious about the frontend path I took, it was roughly:

* jQuery with no framework

* Backbone (for a couple years)

* Backbone + Marionette (for a couple more years)

* Angular (for about a week)

* React (for the past few years)

Re:Django 2.1 released by oneweekwonder on Wednesday August 01, 2018 @12:08PM (#17663804)
When you moved to Angular and later to React did you have any jQuery heavy libraries?

I'm using stuff like slickgrid[0], jquery-ui datepicker, json-editor[1] and wonder how I will drive these components from something like Angular or React?

doh, quickly googled for the github links below and saw there now a slickgrid-es6[2] fork which I have not tried. But my question still stand: how do you drive jquery libs from newer frameworks?

[0]: https://github.com/6pac/SlickGrid/wiki

[1]: https://github.com/json-editor/json-editor

[2]: https://github.com/DimitarChristoff/slickgrid-es6

Re:Django 2.1 released by conradfr on Wednesday August 01, 2018 @12:21PM (#17663955)
I have encapsulated jQuery (including Bootstrap) plugins in AngularJS, React and Vue in the past. They all allow you to access a DOM node somehow.

Maybe it's frowned upon but I don't really like to use those (usually partial) Bootstrap re-implementation, especially in non-SPAs where you already have jQuery and/or Bootstrap.

Of course it's becoming less and less necessary.

Re:Django 2.1 released by johnthedebs on Thursday August 02, 2018 @12:50AM (#17669294)
Other users have already commented, but basically you can wrap jQuery libraries in React components and do a bit of extra work in the lifecycle methods (componentDidMount, componentWillUnmount, etc.) to manage the jQuery bits.

Once you've wrapped it in a component, you can more or less drop that component anywhere in your view hierarchy and not have to think about the fact that it's using jQuery under the hood.

This highlights one of my favorite things about React and similar frameworks, which is that it's the closest thing to actual, useful encapsulation of components I've seen in a frontend framework. It's not perfect, but it's much better than everything I used before it.

Re:Django 2.1 released by always_good on Wednesday August 01, 2018 @01:14PM (#17664528)
You can access the raw DOM node from a React component.

On component mount/unmount, you can apply a jQuery library to the DOM node and optionally clean it up.

It's the same way you can wrap a <canvas> node with a React component and otherwise do all your draws outside of React (like for a game). This way the node is still integrated into your React app but React does nothing more than create/remove it.

Re:Django 2.1 released by blackrock on Wednesday August 01, 2018 @11:46AM (#17663569)
Thanks for the input. Comments like these are insightful.

What do you think of Vue.js?

Re:Django 2.1 released by duiker101 on Wednesday August 01, 2018 @12:08PM (#17663807)
I have spent some time using Vue.js and Django as a backend and I have been pretty satisfied with the results! I will probably try React next just to make sure I am not missing anything. I tried using node as a backend but I couldn't find any framework on the level of Django so I went back to it. There are some pretty decent boilerplates already to setup a Django/Vue website if you look for them.
Re:Django 2.1 released by johnthedebs on Thursday August 02, 2018 @12:43AM (#17669272)
I've heard great things about Vue.js (mostly on HN) but I haven't tried it myself. I'm pretty invested in React (I use it at work and for personal projects), and I find it to be a pleasure to use so I'm not actively seeking out alternatives.

State management with React is another story; I've used Reflux and Redux a lot, and am experimenting with Mobx now.

Re:Django 2.1 released by kennydude on Wednesday August 01, 2018 @12:18PM (#17663927)
Vue is a pleasure to build stuff in. It just seems to work well, especially with nice things like two-way binding out of the box.
Re:Django 2.1 released by ergo14 on Wednesday August 01, 2018 @12:02PM (#17663748)
Vue looks nice, but nowdays I'd pick something like lit-element(lit-html) or stencil.
Re:Django 2.1 released by mrfusion on Wednesday August 01, 2018 @12:18PM (#17663918)
I’m curious what makes react your top pick?
Re:Django 2.1 released by johnthedebs on Thursday August 02, 2018 @12:41AM (#17669269)
Compared with Backbone, I was able to compose and re-compose component structures much more easily. Compared to Angular (which I admittedly don't really know) the API learning curve felt very short and I was able to wrap my head around it very quickly and be productive without constantly looking things up.