TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Dynamic client interaction without big frameworks

1 pointsby dorukcealmost 7 years ago
Hi,<p>I have built a server-rendered django project and I want to implement basic user interactions like adding a tag to a document. In future there can be multiple user actions, but now I just want to add a simple action-ajax-response lifecycle.<p>But I dont want to deep dive into big frameworks like React, Vue etc. and their messy configuration.<p>So here is my questions:<p>- Does jQuery still reliable in 2018?<p>- Is there any javascript library for basic user interactions?<p>- Should I implement my own state-action library or can redux solve it for me without much overhead?<p>- Have you ever been in this situation and what did you do?<p>PS: Sorry for my broken grammar, English is not my primary language.

2 comments

cimmanomalmost 7 years ago
If I understand your use cas properly, jQuery should be plenty; but if you only need to support modern browsers, you can do 98% of what JQuery does using vanilla JavaScript these days, and use lodash for the rest.<p>Consider using server-rendered partials for updating the display. That’s particularly compatible with Django’s templating language.
cutetyalmost 7 years ago
&gt; jQuery<p>Yes, jQuery is still fine, just (maybe) dying a bit in popularity. The biggest problem I think most people had&#x2F;have with jQuery is it doesn’t enforce any kind of structure, therefore leading to a ton of spaghetti code if the developer isn’t already fairly disciplined, unlike React&#x2F;Vue that encourage (almost force) you to write highly modular code through components. However, I think a lot of this was caused by the fact that it was actually pretty hard to write modular JS in jQuery’s hay day, as things like ES6 modules didn’t exist.<p>&gt; Is there a lightweight JS framework for UI?<p>Tons. Are they any good&#x2F;well supported? Meh. I’m sure there are a few good ones out there, but none that have near the amount of dev support that React&#x2F;Vue&#x2F;Angular have. The only one I can think of that I’ve seen mentioned, in a positive manner, that might fall in this category and isn’t one of the ones normally thrown around is Riot.js[1], which may be interesting to you. It&#x27;s mostly just regular JS, though it does have a template system, so depending on who you ask that&#x27;s either really neat&#x2F;good thing or the worst thing since ColdFusion.<p>&gt; Should I implement my own state management lib<p>No.<p>&gt; Redux<p>If you want to use Redux, you might as well add React. While you don’t technically have to use them together, I don’t know why you would use Redux without React (or at all). If you are interested in adding some sort of central state management, and aren’t interesting in adding a framework I’d suggest looking at MobX[2] instead. It’s quite a bit more agnostic than Redux.<p>&gt; Have you ever been in this situation?<p>Yeah, about two(ish) years ago, I found myself working a fairly typical Rails app, and I wasn’t satisfied with how shitty the UI was, and wanted to add some JS crap to achieve the functionality I wanted (i.e more interactive &amp; dynamic interface). I looked at React, tried some tutorials and all that, hated it almost immediately because of all the setup bullshit, weird api naming (which I believe has gotten better), and JSX looked like complete shit to me (still not in love with it).<p>So, I decided to check out this Vue thing that people were starting to talk about (was only an early version 1 then). First impressions were good, I didn’t have to configure a shit load of different build tools to add it to my monolithic Rails app, just added a js file (and you can still just do this), the docs were surprisingly easy to read and really helpful. I was productive with it after a few days, prior I had only done some very minimal jQuery crap. And what initially started out as an effort to add some interactivity turned into the entire frontend being rewritten in Vue because it’s (my opinion) that good.<p>jQuery is still fine, if you’re just looking to add some light interactivity, that’s literally what it’s good for. If you want to make a highly dynamic frontend, you’re probably best of biting the bullet and going for one of the major frameworks (React&#x2F;Vue&#x2F;Angular&#x2F;Ember(?)), as they have the most support and aren’t going to be dropped because the maintainer realized he doesn’t give a shit anymore. And, I’d say Vue is likely the most approachable, as the docs are very good, the community is super helpful, and (if you want to) you can gradually ease into the full blown modern build config setup (vue-cli makes this something you don’t have to even worry about these days though). To start using Vue, you just have to link a js a file in your HTML like the good ol days (or even just use the CDN and not have to download anything)[3], unlike React&#x2F;Angular which require build steps to be in place. I also think, in my slightly biased opinion, Vuex (Vue’s flux-esque state management lib) is the easiest to use, and it doesn’t try to be a general, framework agnostic, lib so it’s highly integrated into Vue which makes it easy add and unobtrusive to use — I add it to any Vue project I’m working on regardless of size because it’s so easy to work with. Not sure most people would be gunning to add Redux (boilerplate) to their projects until it actually needs it.<p>[1] <a href="https:&#x2F;&#x2F;riot.js.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;riot.js.org&#x2F;</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;mobxjs&#x2F;mobx" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mobxjs&#x2F;mobx</a><p>[3] <a href="https:&#x2F;&#x2F;vuejs.org&#x2F;v2&#x2F;guide&#x2F;installation.html#Direct-lt-script-gt-Include" rel="nofollow">https:&#x2F;&#x2F;vuejs.org&#x2F;v2&#x2F;guide&#x2F;installation.html#Direct-lt-scrip...</a>
评论 #17609314 未加载