HTML Templates Instead Of Reactivity | Prime Reacts

Поделиться
HTML-код
  • Опубликовано: 29 сен 2024
  • Recorded live on twitch, GET IN
    / theprimeagen
    Become a backend engineer. Its my favorite site
    boot.dev/?prom...
    This is also the best way to support me is to support yourself becoming a better backend engineer.
    Reviewed article: guseyn.com/htm...
    By: Guseyn Ismayylov
    MY MAIN YT CHANNEL: Has well edited engineering videos
    / theprimeagen
    Discord
    / discord
    Have something for me to read or react to?: / theprimeagenreact
    Kinesis Advantage 360: bit.ly/Prime-K...
    Hey I am sponsored by Turso, an edge database. I think they are pretty neet. Give them a try for free and if you want you can get a decent amount off (the free tier is the best (better than planetscale or any other))
    turso.tech/dee...

Комментарии • 447

  • @ragnarok7976
    @ragnarok7976 8 месяцев назад +17

    "the DOM is slow"
    > What if we had two of them?

  • @xxapoloxx
    @xxapoloxx 9 месяцев назад +260

    The solution is pretty straight forward, accept that html and http are stateless environments and stop trying to put a square peg in a round hole.

    • @yegorzakharov8514
      @yegorzakharov8514 9 месяцев назад

      Careful, or I'll put my peg in your square.

    • @indiesigi7807
      @indiesigi7807 9 месяцев назад +61

      The solution is accepting this is a client server model and state needs to be synced just like any other client server implementation.

    • @unicodefox
      @unicodefox 9 месяцев назад +49

      http also defines we should send all username and password in (almost) plain text and i don't see the engineers recommending that

    • @armandoleon9901
      @armandoleon9901 9 месяцев назад +2

      Hey, I read a book and finally understands what this sentence means. Curious, will there be a push one day for new hypermedia controls to fill in the gaps that client side stuff is doing rn?

    • @XxZeldaxXXxLinkxX
      @XxZeldaxXXxLinkxX 9 месяцев назад +24

      So you want to go back to the olden days where doing literally anything will refresh the page?

  • @Azurryu
    @Azurryu 8 месяцев назад +1

    That's roughly how I make use of templates where I can't make use of frontend frameworks, but the articles arguments are not really correct because they didn't even solve what those frameworks solve. It's fun to replicate what these frameworks do and I did so myself to understand how Vue, for example, achieves their reactivity.

  • @TheNivk1994
    @TheNivk1994 9 месяцев назад +8

    It is okayish, but lacks foundation and the template should not say what happens and where but I think it’s totally fine to subject those topics. The framework hell is not a good solution. I am awaiting the proposals that are there for ES to come like the NodeParts, placeholder in templates and the new redesigned html imports.

    • @theodorealenas3171
      @theodorealenas3171 9 месяцев назад

      Yeah. I wonder why they didn't go for LaTeX macros too btw. To define a li with an a and preset attributes. But maybe these will do

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      I am the author of this article, you can check EHTML to see a really good examples where I am mapping AJAX JSON responses on html templates just using HTML.

  • @Cyberfoxxy
    @Cyberfoxxy 8 месяцев назад

    I love his first snippet. But I do have beef with the "1"*1. He's being a smartass and sacrificed readability in the process.

  • @genechristiansomoza4931
    @genechristiansomoza4931 8 месяцев назад +1

    Template element is not readable for me. I like the global state in window.

  • @applepie9806
    @applepie9806 9 месяцев назад

    Whew, that first paragraph is the hottest of takes. I do agree that while React is useful, we should all still know vanilla JS.

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      React is harmful. It solves non existing problems.

  • @BogdanNourescu
    @BogdanNourescu 8 месяцев назад

    A framework i love that is using templates and a way to integrate state into the templates is Lit. I find it to be a more elegant solution and its a very small framework, but not very popular
    Initially it was an idea similar from your video called Polimer (the first version of Lit)

  • @mkrzyzowski
    @mkrzyzowski 8 месяцев назад

    "-5.6" * 1 OR +"-5.6" which is my preference

  • @thesaintseiya
    @thesaintseiya 9 месяцев назад +14

    Noob question but if htmx has to make server requests for html, what happens to a user in Australia using a website which has servers in the US? Isn't it just slow and unresponsive

    • @basione
      @basione 9 месяцев назад +9

      That'd be an architectural issue. No front-end technology can make that data arrive faster across the globe.

    • @kphaxx
      @kphaxx 9 месяцев назад +3

      ??? It doesn't have to render everything server-side. It's not like every partial update to the DOM must be driven by ajax requests.

    • @Tekay37
      @Tekay37 9 месяцев назад +6

      No, the difference is the client asking the server for html snippets vs the client asking the server for json. You keep the delay between request and response, but you reduce the javascript overhead. You likely even get a more responsive website with htmx because there is no need any more to have consecutive ajax requests for loading a single page.

    • @proletar-ian
      @proletar-ian 9 месяцев назад +1

      Yep - you're hoping that the devs set up infrastructure near Australia

    • @antongorov5275
      @antongorov5275 9 месяцев назад +4

      @@basione But you don't need data arrival across the globe if you store the state client side, do you?

  • @GrantGryczan
    @GrantGryczan 9 месяцев назад +3

    This is one reason we use frameworks, so we don't have to deal with every codebase maintaining its own (to be blunt) crappy solution like this. In vanilla JS, everyone just comes up with a different crappy solution. With a crappy framework, at least we're all using the _same_ crappy solution. (Though it doesn't have to be crappy--some frameworks are good.)

    • @dripcaraybbx
      @dripcaraybbx 9 месяцев назад +2

      Who is "we all?" Other people on your team? Other users of the framework who use it on their own project?

    • @GrantGryczan
      @GrantGryczan 9 месяцев назад

      @@dripcaraybbx Web developers who use a framework.
      To elaborate: if an app uses React, even though I don't like React, and React has a _lot_ of problems, at least I can read and contribute to the code (usually). But if an app uses vanilla JS, I probably won't be able to easily decipher their codebase, let alone contribute to it, unless every previous main contributor happened to be excellent at designing and writing maintainable code, as well as documenting it. For example, it would be annoying, if not difficult and very time-consuming, to read or contribute to an app written the way the code in the article is written.

    • @dripcaraybbx
      @dripcaraybbx 9 месяцев назад

      @@GrantGryczan On a large project, I feel like this is what a team should be able to do. The architect or senior devs should be able to define a library or abstractions based on a ubiquitous technology that doesn't lock them into a dependency. So, as long as users have browsers, why not develop the internal framework that works for your entire team? Better than than install all those stupid React files on build (just because that's what Facebook needs) or replicate the DOM.

    • @GrantGryczan
      @GrantGryczan 9 месяцев назад +1

      @@dripcaraybbx Yeah, that's what every great developer should be able to do. And I wouldn't doubt that you, I, or any senior engineer at a big tech company could do that. But many (if not most) developers, at companies that can't afford to be picky, simply don't know how to write maintainable code. A lot of developers I see at workplaces only have experience from courses they took in college for a bachelor's degree. They never touched anything even remotely programming-related outside school, and they still don't outside work. They cruise at the knowledge level school left them with, because hey, they make a living, and that might be the only aspect of software development they care about. Good for them!
      So if I were to join a project, I wouldn't trust a vanilla JS project to be enjoyable to work on as much as I would a React project. React is a really crappy framework, but at least the level of crappiness is much more limited by the framework than it would be if written with the freedom of the entire realm of possibility of vanilla JS. When I join a project using a framework, I know exactly what I'm getting into, and I can use my prior knowledge of the framework rather than having to get used to what is most likely going to be a tightly coupled ball of spaghetti written in vanilla JS, such as the not-that-maintainable code from this article (although I've seen much worse).
      And that's not to say framework code can't be unmaintainable or tightly coupled, but just that framework code is infinitely more limited in the ways it can be.

    • @dripcaraybbx
      @dripcaraybbx 9 месяцев назад

      @@GrantGryczan If React is a crappy framework compared to other libraries built on the same JavaScript, I would say it's a function of the framework not JavaScript

  • @nexovec
    @nexovec 8 месяцев назад

    OOH, coming in hot! >> dis them react plebs LOL

  • @jenreiss3107
    @jenreiss3107 9 месяцев назад +3

    I've been saying for a while that Rust's Tonic GRPC framework on the backend with Ruby's Sinatra+HTMX on the frontend is THE stack for 2024

    • @thebrowhodoesntlift9613
      @thebrowhodoesntlift9613 9 месяцев назад +2

      Sinatra? Do you mean Leptos? 🦀

    • @remsee1608
      @remsee1608 9 месяцев назад

      He’s not writing a Solidity backen NGMI

    • @jenreiss3107
      @jenreiss3107 9 месяцев назад

      YUCK. I'm done writing client side applications. I'd rather write htmx in an actually comfortable language like ruby than do crazy wasm stuff that's still going to end up calling JS at the end of the day@@thebrowhodoesntlift9613

  • @ryanleemartin7758
    @ryanleemartin7758 9 месяцев назад

    SHOTS FIRED!

  • @heliospace
    @heliospace 8 месяцев назад

    Bro I'm sorry but I'm confused.

  • @adaliszk
    @adaliszk 9 месяцев назад

    Attempt #4: Polymer and Lit

  • @petermeshackjobs8076
    @petermeshackjobs8076 9 месяцев назад

    why do i always confuse this guy's look with Dr Disrespect even the way he talks. no offense

  • @steveoc64
    @steveoc64 8 месяцев назад

    Application state belongs on the server, not the client.
    Even a 5 year old iPhone has enough CPU resources to manage application state for hundreds of thousands of concurrent users
    This trend for moving state to the client made sense when networks were slow, and server CPU/RAM was extremely limited … but that ended decades ago

  • @edumorangobolcombr
    @edumorangobolcombr 9 месяцев назад +1

    How can the virtual dom be faster then the DOM being the former in JS and the latter native?

    • @stevezelaznik5872
      @stevezelaznik5872 9 месяцев назад

      To see if a value has changed, you have to do something like document.querySelector(some_css_path).textContent, and THEN perform the operation you want in javascript. That’s much slower than javascript comparing two values. Again maybe DOM access has gotten better since the early days of React 🤷

  • @rand0mtv660
    @rand0mtv660 8 месяцев назад

    I do not understand all this hate for VirtualDOM in the last 1-2 years or so. People are writing about it as if it's something you actually use daily. It's an internal implementation detail you don't interact with, but all of a sudden everyone is writing about it like it's some API you have to use and it sucks.
    I do understand the hate towards JSX (even though I like it) for example because that's a templating language in React (and now in other frameworks) you use all the time so you actually interact with it and of course you can like/dislike it, but I don't understand the hate for VirtualDOM beyond maybe complaining about its performance these days compared to some other solutions.

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      Because it was presented intentionally (in my opinion) as a solution for non-existent problem. The claim was that DOM was slow. But it’s always been a false statement. DOM was slow only in bloated and overfeatured Facebook.

    • @rand0mtv660
      @rand0mtv660 8 месяцев назад

      @@guseynismayylov1945 but DOM manipulation is slow, at least the way we did it during jQuery era. You also have to realize React was made over 10 years ago. Lot of things were different then. I'm quite sure React team would have done things differently if they did React from scratch now.
      To be honest I can understand all the hate for some other React features, but I feel like VirtualDOM is just one of those things people repeatedly claim is bad because they are just rehashing other people's opinion.

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      @@rand0mtv660 React team made a lot of questionable things, so I am not going to dive into what they would have done differently. They brainwashed tons of inexperienced developers into thinking that the design of React is pinnacle of frontend development.
      Keeping your state always visible on screen is such a little problem, that I even till this day don’t understand why the f we need reactivity.
      The more interesting problems like “how can I fetch data in the most painless way and map that data to HTML”, or “how can I update different parts of my application” or “how can I build forms, markdowns integrated in HTML” etc. Those problems took a decade for React team kinda implement in their way with Suspense and other stuff. But still the design is so ugly… they just don’t have taste
      Check out my solution EHTML, I am the author of this article btw

    • @rand0mtv660
      @rand0mtv660 8 месяцев назад +1

      @@guseynismayylov1945 I checked out your solution and I don't like it at a first glance. I'll try it out to build something in order to form my final opinion.
      Although props to you for coming up with your own solution for certain problems, even though I might not like or agree with it in the end.

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      @@rand0mtv660 you can check demos. But it’s okay if you don’t like. I am encouraging people to be more critical about hype around some technology.

  • @m-ok-6379
    @m-ok-6379 9 месяцев назад +262

    These frameworks were meant for Single Page Applications, not the whole company website.

    • @elmertsai1312
      @elmertsai1312 9 месяцев назад +32

      this is so true.... the feature creeping is so insane nowadays

    • @tri__yt
      @tri__yt 9 месяцев назад +51

      100%. The JS community didn't lose me with React. They lost me when people started converting their blogs to React and locking themselves in to server-side javascript and proprietary cloud-products-build-on-other-cloud-products in order to use their front-end frameworks. But React is still a good solution for me when I need a highly interactive SPA. And yes, I have to develop it as a separate application from the server, both with a sensible API, state machines, etc. Pick the right tool 🤷‍♂

    • @edhahaz
      @edhahaz 9 месяцев назад +14

      Yeah let me switch my company website to an SPA in some parts, sometimes, somewhere, oh wait the shitty technology can't support that and it barely integrates. What if we just SPA?Oh it works, cool.

    • @dovahsenbrom836
      @dovahsenbrom836 9 месяцев назад +4

      react is a lib, not a framework

    • @asdqwe4427
      @asdqwe4427 8 месяцев назад +4

      ⁠​⁠@@tri__yt I agree. People lose the distinction of website and app. And if you are in the middle (Nextjs), that seems to be the worst place to be

  • @wlockuz4467
    @wlockuz4467 9 месяцев назад +66

    That article had the "He is confused but he has got the spirit" energy
    I agree with his take that things have gotten so complicated over the past few years but whatever he was creating didn't make much sense.

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      Hi, I am the author of this article, you can checkout EHTML, hopefully it would make more sense for you. Cheers!

  • @ReedoTV
    @ReedoTV 9 месяцев назад +108

    This comes from the mind of someone who only knows frameworks.
    We will forever repeat the mistakes of the past.

    • @theodorealenas3171
      @theodorealenas3171 9 месяцев назад

      I don't know how to interpret this, but you got my attention. How would it be from someone who's only seen the framework light approach

    • @ReedoTV
      @ReedoTV 9 месяцев назад +25

      @@theodorealenas3171 Managing state and dom was as total mess, so frameworks like Angular and React came onto the scene to try and manage those issues.
      Arguably we've gone way too far the other way, but the younger devs won't have experienced the problems that led to those frameworks, so their new solutions may just end up taking us backwards.
      However, maybe the platform as a whole is now so much better that those more direct solutions are now viable again.
      I don't know xD

    • @axelramirezludewig306
      @axelramirezludewig306 9 месяцев назад +8

      @@ReedoTV Bravo dude, they're reinventing PHP and then they will reinvent NextJS

    • @michalkowalik89
      @michalkowalik89 9 месяцев назад +6

      im waiting for MVC and active records to be a think again

    • @RealDevastatia
      @RealDevastatia 8 месяцев назад +3

      @@michalkowalik89 Right? A controller is nothing but a glorified switch statement. And framework people build entire vast hierarchies of the darned things!

  • @reinoob
    @reinoob 9 месяцев назад +16

    PHP i the answer and no one realizes.

    • @dripcaraybbx
      @dripcaraybbx 9 месяцев назад +1

      reluctant like

    • @bionic_batman
      @bionic_batman 8 месяцев назад +3

      And JQuery if you want your pages to have fancy dynamic elements

  • @pesterenan
    @pesterenan 9 месяцев назад +17

    Rumors out that this is what "Rick" was working on before getting fired.

    • @RaveYoda
      @RaveYoda 9 месяцев назад +4

      Got 'em! 😆

  • @dromedda6810
    @dromedda6810 9 месяцев назад +8

    bro cooked, and then overcooked... i agree with the cooking, just not what actually ended up on my plate

    • @guseynismayylov1945
      @guseynismayylov1945 9 месяцев назад

      Just checkout EHTML if you want to see a good example. I am the author of this article.

  • @josegabrielgruber
    @josegabrielgruber 9 месяцев назад +21

    And this is how EHTML framework has born.
    I'm not joking, the author transformed this into a framework, I'm find it interesting and constructive, very cool article for just thinking things different

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад +12

      Thanks for the feedback. Actually I created this framework 4 years ago, just because I wanted to quickly make AJAX requests and map responses to HTML without the need to create elements in JavaScript. This article was written just to demonstrate the idea in vacuum. Also, I have ideas on how to introduce type safety via linter into this concept.

    • @rajmajumdar5253
      @rajmajumdar5253 8 месяцев назад +2

      ​@@guseynismayylov1945 wait you created EHTML?

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      @@rajmajumdar5253 yes, I am creator of EHTML

  • @maelstrom57
    @maelstrom57 9 месяцев назад +29

    Not a fan of this approach. I've never once needed to rely on an element's attributes to manage my state except maybe for styling purposes. I'm not the biggest fan of React either but even hooks aren't as unwieldy as this.

    • @EdwinMartin
      @EdwinMartin 8 месяцев назад +1

      You’re not a fan because you’ve never done this? Interesting approach to software development 😄

    • @maelstrom57
      @maelstrom57 8 месяцев назад +5

      @@EdwinMartin I have, when I was a noob. Great argument btw. I've never driven with my back to the wheel either; I still know it's a sh#t way to drive.

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      I am the author of this article, if you want to see good examples, you should check EHTML

    • @guseynismayylov1945
      @guseynismayylov1945 4 месяца назад

      This idea is the core of EHTML framework/library.

  • @basefocus8969
    @basefocus8969 9 месяцев назад +18

    And this guys how we got to 30 javascript frameworks!

    • @apollolux
      @apollolux 9 месяцев назад +5

      Cue XKCD "Standards" comic: 30+1 frameworks, or as JS sometimes processes it...301 frameworks. ;)

    • @charlesbenca5357
      @charlesbenca5357 2 месяца назад

      and you are the reason i have a crap code base at work

  • @besknighter
    @besknighter 9 месяцев назад +48

    Every passing day I get ever more grateful I don't work with web.

    • @ScienceAfterDark
      @ScienceAfterDark 9 месяцев назад +17

      Indeed, Webdev is such a convoluted mess of misery and tangled frameworks! Then again... developing for Windows UI, with Microsoft continuously reinventing Windows UI programming in ever worse ways isn't much better. Then you've got the multiheaded abstracted monster that is modern C++... I guess the ticket is: just stick with embedded programming in nice beautiful simple C!

    • @hamm8934
      @hamm8934 8 месяцев назад +7

      @@ScienceAfterDark The trick is to make your own product and work for yourself so that you can use the tools you want to :)

    • @patocarrasco6266
      @patocarrasco6266 8 месяцев назад +3

      @@hamm8934 and then you become Rick hahahha

    • @PsychoDude
      @PsychoDude 8 месяцев назад +1

      ​@patorasco6266 i laughed too hard

    • @ragnarok7976
      @ragnarok7976 8 месяцев назад +2

      The web is great, the problem is it's every script-kiddies first exposure to programming so there is going to be a lot of stupid shit.
      That said if you are the one setting the rules it's just as fun as any other platform because you can use the smart and throw out the stupid.

  • @FROZENbender
    @FROZENbender 9 месяцев назад +16

    his approach reminds me of these super verbose xml protocols where you had a hundred elements with a hundred attributes and all it did was "int i = 1; i = i * 2". Getting nightmares from his example but I like that he's trying. I myself have went back into pure html + js and tried to reimplement mechanisms that transform page layout and reactivity in a clean and concise manner without a 500kb framework in the background. it's a powerful learning experience and it's making me want to rewrite my website for the n-th time, without a framework.

    • @theodorealenas3171
      @theodorealenas3171 9 месяцев назад +1

      This is the part I don't understand, how does a personal website benefit from reactivity and state?

    • @pieflies
      @pieflies 9 месяцев назад

      @@theodorealenas3171it usually doesn’t. There’s generally no need to use something like React, Angular, etc. for a personal website and most people who do so seem to do it just because they stick with what they already know and try to use that for everything.

    • @eatenpancreas
      @eatenpancreas 9 месяцев назад

      .NET maui go brrrrrrrr

    • @renx81
      @renx81 8 месяцев назад

      JDSL ftw! Tom always knew

    • @renx81
      @renx81 8 месяцев назад +1

      @@theodorealenas3171 You must lack imagination.

  • @therealguanzo
    @therealguanzo 9 месяцев назад +4

    This guy just built his own crappy framework with 1 user. Why not instead use a proven, battle tested framework that thousands of people use daily, that can help each other out and improve the collective knowledge?

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад +1

      I also built whole application based on it. If I could find a framework that could do what EHTML can, I would not bother.

    • @larjasoul
      @larjasoul 2 месяца назад

      Because it's a deadlock to getting out an application, in some settings.
      You know the "build your stack" obsessors? Who basically do what Skyrim modders do (99% configuration, 1% playing)?
      Programming languages are already so powerful. It's easy to take a few hours to write a few functions to do exactly what you need for your specific application. And, then you'll understand everything going on, instead of adopting some hyped-up black box.
      Frameworks make anything that's not in the scope of the framework way harder. Simple example: basic canvas animation in React vs raw JS.
      But if you want me to give you a simple example: consider getting out a JSX / frameworked-up app as fast as possible, vs pumping out a slaw of PHP as fast as possible.
      In my experience, the first takes ages for people to figure out how to tame their dependency dragon; often longer than it takes for some PHP loser to pump out some garbage functions that do exactly what he needs.

  • @BingleBangleBungle
    @BingleBangleBungle 8 месяцев назад +4

    Looks like AlpineJS.

  • @itskittyme
    @itskittyme 9 месяцев назад +12

    Isn't Vue doing similar things like this, but way better?
    I've learned Vue during covid and I'm such a fan,
    and I feel Vue is doing what this person is trying to do. But better.

    • @hamm8934
      @hamm8934 9 месяцев назад

      Yup :) with the powerhouse of Evan You leading us to the promised land

  • @RasmusSchultz
    @RasmusSchultz 8 месяцев назад +2

    garbage. 😒
    "look, we can just use template tags!"
    the first thing he hasn't even addressed at all is updates - anything you clone from a template becomes just DOM elements with all the same difficulties. updating a single text node, sure. now try updating a list? ha ha. try adding or removing elements from a list. try getting portions of UI to get added or removed on the fly. this is where the fun starts and pretty soon you've built yet another half-baked framework.
    if you've been here for long enough, you've been there. 😅
    I remember doing something similar way back in the jQuery days - before but we would just put the templates in nodes. no big difference - as soon as you start adding interpolation syntax to your tags, you've gone outside native HTML, you're building your own template engine anyway.
    sorry, but there is no idea here. get back to work. 😉

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      I am the author of this article. If you need update list of elements you use forEach template. You just release templates with new mapped data, you don’t need to create anything. Check EHTML, you will find more valid examples

  • @danielvaughn4551
    @danielvaughn4551 9 месяцев назад +12

    If we let bro cook any longer, Gordon Ramsey's going to burst down the door and scream "IT'S FUCKING RAW"

  • @Euphorya
    @Euphorya 9 месяцев назад +6

    This feels very close to AlpineJS to me.

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      It’s coming from EHTML. I am the author of this article.

  • @andrewshirley9240
    @andrewshirley9240 9 месяцев назад +55

    8:10 Read from the article, "You can already imagine how much easier it is to share state...." Imagine writing that as if it's a good thing lol. Shared state is basically the source of all spaghetti.

    • @germanmalinovsky1719
      @germanmalinovsky1719 9 месяцев назад +4

      true, it ends up with a high coupling

    • @avwie132
      @avwie132 9 месяцев назад +10

      Shared writable state is. Shared observable state isn’t.
      One owner of data, multiple consumers of data

    • @dripcaraybbx
      @dripcaraybbx 9 месяцев назад

      How spaghetti can my vet's About Me page be?

    • @keldencowan
      @keldencowan 9 месяцев назад +1

      @@dripcaraybbx Not very spaghetti because that's a static HTML file that doesn't need or js or any mutable state at all. I don't really see how that's a fair comparison to a stateful application.

    • @germanmalinovsky1719
      @germanmalinovsky1719 9 месяцев назад

      @@avwie132 This does not negate high binding. Your components depend on another component and wait for a value to be initialized. Also, if you want to change the state structure and don't know who is using what, you will break the application because of the high coupling. So this approach doesn't scale. But for small sites it will do fine.

  • @TheVege1
    @TheVege1 8 месяцев назад +1

    I hate when my server returns html. Html response means that you don't have any control of your data on the client side at all. Also, all of your endpoints began to look ugly. Also, it oddly separates logic- and logicless parts of your html. I want my APIs to return some helpful format (mainly json, of course).
    But I found the perfect solution for me: use htmx alongside nunjucks in case I need some data manipulations on the client side or use mustache otherwise.

  • @roymarshall_
    @roymarshall_ 9 месяцев назад +3

    I'll be honest those examples look awful, I'd much prefer to just use React.

  • @PieterWigboldus
    @PieterWigboldus 8 месяцев назад +2

    Like HTMX but just native

  • @orterves
    @orterves 9 месяцев назад +6

    Specifically, application state (ie the domain model) should be parallel to the view model. Embedding state within the components that isn't totally isolated to the components is OOP goop all over again.
    Allow the components to access/bring in the application state, but don't embed that state within the components

  • @ted9
    @ted9 8 месяцев назад +1

    mxml and actionscript was the best front end language ever.. databinding both ways, treeviews, treetables, accordion, they have them all you name it.. unfortunately it needed a flash plugin to run in the browser.. and now its dead.. thing is html is like 30 years old and was never meant to build UI.. so what we have now is like a tech soup just to have something decent running in the front end.. i think its time they reinvent the wheel so browsers support better languages so we can use 1 language to build the UI.. i dont understand that they dont understand the problem here..

  • @chang112x
    @chang112x 9 месяцев назад +22

    I used Handlebars or Mustache with template tag and vanilla js so you can inject js variables and you have a decent template language with if, foreach, etc... It works and it is pretty straightforward

    • @RealDevastatia
      @RealDevastatia 8 месяцев назад +1

      Look up Mark Turansky's "Better JavaScript Templates." ASP-style templates that support native JavaScript without a template language. Sometimes less is more.

    • @benmcmullan718
      @benmcmullan718 2 месяца назад

      I love Handlebars but I feel like I need to move onto something like React for the future?

  • @PostMeridianLyf
    @PostMeridianLyf 8 месяцев назад +4

    All of your videos are so jam packed with information and your character makes it so easy to ingest! Love it

  • @arnaudparan1419
    @arnaudparan1419 8 месяцев назад +2

    4:58 that's not true. state = {count:0} puts state on window but const state = {count:0} does not

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      It meant global in terms of scope, but you're right

  • @someman7
    @someman7 8 месяцев назад +3

    Generally, it's more desirable to distribute work and memory requirements to clients I think. Not everyone is a company that has resources to stream _videos_ to viewers globally

  • @waltermelo1033
    @waltermelo1033 8 месяцев назад +2

    I'm more a designer than a dev today. but my background is in Front End. last time I was doing just. a favor for a friend to help him launch their startup. It was just a website, just a F# website. not an application. it was being dealed by their front-end team. I'm pretty good at HTML/CSS (I know its not programming) so I can draw then build what I done. gosh, how much EASIER would be if I could not use NEXT JS there!!! build processes are horrible. it it was just a static site, they would not be "screaming" at me because THEIR SERVER had an incompatibility with next 14, and I need to go back to 13 and change everything I done just. to help a friend (I'm questioning if it's still my friend btw).
    HTMX and etc. seems like a breath of fresh air. a fixing on the hell developers look like they have conspired to make. definitely DONT use these to make just simple websites! it's painful.

  • @remsee1608
    @remsee1608 9 месяцев назад +3

    So people really not know about div elements?

  • @aminallam4188
    @aminallam4188 9 месяцев назад +83

    I’ve been building web apps without front-end libraries for the past year. I don’t use this guy’s approach with the template tag, but for me I find it much easier to just append to the Dom as needed. This idea that the code becomes unmanageable is a self fulfilling prophecy, not an actuality.

    • @Niosus
      @Niosus 9 месяцев назад +21

      Working directly on the DOM is jQuery all over again. What's old, is new.

    • @georgehelyar
      @georgehelyar 9 месяцев назад +37

      ​​@@Niosushonestly I'd take jQuery over these heavy modern frameworks and npm package hell any day.
      Remember when you could just add jQuery as a script tag from a CDN and be done with it?
      You don't even need jQuery to do it any more now that modern JS has more features and IE is dead, you can just use vanilla JS easily

    • @theodorealenas3171
      @theodorealenas3171 9 месяцев назад +2

      I made my site's menus with JavaScript, while the rest was hand written HTML.
      Then I was sorry that Emacs' web browser couldn't render it and I redid it in PHP. But how: the PHP tag opens inside of the markup, to give attributes to the elements.
      It took several iterations before I accepted there's only going to be 4 menu elements anyway

    • @aminallam4188
      @aminallam4188 9 месяцев назад +2

      @@georgehelyar yeah I was thinking the same thing. I know Jquery is still around but it’s kinda obsolete with modern js updates. Also jquery syntax is awful to look at.

    • @dovahsenbrom836
      @dovahsenbrom836 9 месяцев назад +2

      you should learn C

  • @istovall2624
    @istovall2624 8 месяцев назад +1

    And they joked about me as a programming language - HTML

  • @georgebeierberkeley
    @georgebeierberkeley 8 месяцев назад +1

    All I can say is "hallelujah"! I never understood replicating all the state on the client with complicated frameworks. Sure, it works great for Facebook, but most apps aren't Facebook. So much easier to just bring down the HTML with SSR, and adjust the pages as needed with vanilla js. Btw as a C#/vanilla JS/Azure programmer about 3/4 of Prime's stuff goes right over my head. OK, maybe 7/8....

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      I am the author of this article, you should check EHTML, probably you would find it very useful

  • @dovahsenbrom836
    @dovahsenbrom836 9 месяцев назад +4

    Reactivity is bad // proceeds to use obscure language features to implement React

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      To see good examples checkout EHTML. I am the author of this article

    • @guseynismayylov1945
      @guseynismayylov1945 4 месяца назад

      This idea is the core of EHTML framework/library.

  • @stackercoding2054
    @stackercoding2054 9 месяцев назад +3

    nothing like typing html inside multi line strings and appending them to the DOM with jquery, good old days

  • @alexeyku8926
    @alexeyku8926 9 месяцев назад +2

    congrats guys, they reinvented forgotten knockout js

  • @O_Eduardo
    @O_Eduardo 9 месяцев назад +2

    I still believe that jails-js is a better alternative about "diferent way to think".
    There are too many solutions full html or full js, and very less alternative like Jails which is use html and write logic on top of that without losing your mind...
    It´s not because I thought about it, but I can´t see anything alike... and I wanted to see more... Not a React/Angular fan... not a htmx fan either... they live too much in the extreme edge for me...

  • @64jcl
    @64jcl 8 месяцев назад

    He started off good but then it became another mess of figuring out the magic keywords to do stuff in the templates which I find annoying in all the other frameworks as well. I recently dabbled with something similar but where I instead use java class to define components each with their own template and proxy for model mapping so it can re-render itself in the dom on model changes. Furthermore I used Javascripts lovely untyped prototype stuff to auto generate functions on the fly for the classes so that you can programmatically set styles, classes and update model as if it was a poco (plain old class object). So in a sense it feels more like developing a desktop application in the good old days, here is an example:
    class MyApp extends App {
    constructor() {
    let para = this.add(new Paragraph({ class: 'my-paragraph' }));
    this.add(new Button({ text: 'Click me' })).setBorderWidth('5px').setOnClick((button) => {
    para.setText('Hey stop clicking me!'); // auto function to template props
    button.model.text = 'Ouch!'; // example to set model directly on button
    });
    }
    }
    new App();
    App inherits a Container class and has a default column layout using FlexBox, but any container can initialize their own FlexBox with whatever layout they want. All base components have functions for setting all style directly or several can be set by using a object, for example para.setStyle({ padding:1, fontSize:2 }). Each container can have their own base unit, default is rem and 100% font-size on body as it is then easy to adjust size of whole UX by just modifying body %. Ofc any can set class (and have helpers for adding/removing) so if you want you can add plain css files yourself as before to style everything.
    You can ofc make your own components and even just write your event handlers directly like this:
    class MyButton extends Button {
    onClick() {
    this.setText('Touch me again...');
    }
    }
    Using setOnClick() will override the default onClick implementation. A cool thing is also that the CSS classes are injected in the page head dynamically so it is quite easy to define some variables that is used to parameterize the styles and hence does not need any preprocessors. Basically the goal of the project was to have plain JS without the need to compile anything to get stuff running, although the auto-prototyping on the fly is a sort of compiling I guess. Creating new components ofc requires you to specify your template (simple string expansion from model variables). Still early days but it works quite well and the fun thing is that I can code in plain Javascript to create a frontend with no mucking about with typing in bindings between html code and the javascript code.

  • @ChamplooMusashi
    @ChamplooMusashi 9 месяцев назад +2

    next post from this author: "honey i made another js framework"

  • @Kotfluegel
    @Kotfluegel 8 месяцев назад +1

    Yes, using const foo = ... you get a global thing on window.
    If we want multiple libraries by multiple authors, we will arrive at the conclusion, that global state might not be a good idea unless we force every library author to prefix their global variable names with a unique prefix or namespace noone else is allowed to use. Good luck with that.
    No problem, we can simply wrap all of our library code into an IIFE. Too complicated and ugly, because it adds one mandatory indent level to your js files? No problem, we simply add a build tool, that wraps all code from a js file into an iife automatically at build time. Oh wait...

  • @DevMeloy
    @DevMeloy 8 месяцев назад +2

    I've made a couple projects with web components and wish more developers left frameworks and started using native controls.

  • @oscarheerkensthijssen5454
    @oscarheerkensthijssen5454 8 месяцев назад +3

    “He is low key inventing a new framework” 😂

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      I am the author of this article, you can take a look at EHMTL

    • @guseynismayylov1945
      @guseynismayylov1945 4 месяца назад

      This idea is the core of EHTML framework/library.

  • @blarvinius
    @blarvinius 18 дней назад

    I haven't tried HTMX yet, because I want to build THICC CLIENTS. I'm a novice dev choking to death on React and wondering why the ideas of HTMX aren't more client sided?

  • @unitedstatesofpostamerica7559
    @unitedstatesofpostamerica7559 9 месяцев назад +12

    Omg, here it comes we’re going back to good ole HTML/CSS

  • @patiencebear
    @patiencebear 9 месяцев назад +3

    The more complex a solution is, the more unlikely it should be the default approach.

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      According to this logic React doesn’t stand a chance

    • @patiencebear
      @patiencebear 8 месяцев назад

      @@guseynismayylov1945 Sadly, the realms of ought and are, are rarely converging.

  • @0runny
    @0runny 8 месяцев назад +1

    As a veteran programmer with +30 years experience, the entire JavaScript eco system is the biggest pile of shite in the history of computing.

  • @SemenAlexndrovich
    @SemenAlexndrovich 9 месяцев назад +4

    I guess that Alpine.js is the most close complete solution

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      I am the author of this article, you can check EHTML for really good examples.

  • @RealDevastatia
    @RealDevastatia 8 месяцев назад +1

    Hot take: Everyone in the comments saying "use this or that framework instead" needs to learn JavaScript.

  • @terrencemoore8739
    @terrencemoore8739 Месяц назад

    There's a JS library called reef.js, it adds the concept of signals to vanilla ja and works well with web components because the author is a vanilla js/web component fan

  • @kasper_573
    @kasper_573 9 месяцев назад +23

    For anyone still worried about the job market: These are the type of articles that will ”educate” our next generation programmers. You’ll be fine.

    • @theodorealenas3171
      @theodorealenas3171 9 месяцев назад +1

      For the next 10 years says Robert Martin. That's before I'll retire so I may get to see the sunrise

    • @gileee
      @gileee 8 месяцев назад

      ​@@theodorealenas3171 I don't trust Bob to watch over a painted sheep

    • @theodorealenas3171
      @theodorealenas3171 8 месяцев назад

      @@gileee I don't trust you to ship a painted watch

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      @@theodorealenas3171how are you going to retire, tell a secret

  • @rodrigoserafim8834
    @rodrigoserafim8834 8 месяцев назад

    Both this article and Htmx suffer from NIH (Not Invented Here) syndrome so much that its not even funny.
    Literally re-solving the same problems that have already been solved 1000 times with a "small" home grown "not-a-framework" that over the years will slowly be incremented into a framework with strict "recommended" guidelines that is no longer small.

  • @sk-sm9sh
    @sk-sm9sh 6 месяцев назад

    Global 'window' is legacy. But that doesn't mean we have to reference it every single time. You can ask window as argument in every function and that's what I prefer to do. This creates the annoying problem of prop passing which I consider a good problem to have because this forces to think about application design.

  • @rich1051414
    @rich1051414 7 месяцев назад

    A number in string form * 1 basically does Number(stringnumber). It's faster to type, that's all.

  • @nr7343
    @nr7343 Месяц назад

    Who use innerHTML?
    All this post look like a ai generator... bc a lot of garbage there amd sure not unique

  • @ragectl
    @ragectl 8 месяцев назад

    Reading the start, this person is just looking for LuaX 🤔
    HTMX seems like a popular answer too 😂
    Also the person who wrote the article has clearly climbed Mt Stupid (which needs to be a tshirt)

  • @DontFollowZim
    @DontFollowZim 8 месяцев назад

    I've done similar stuff in the past. I hated it.
    For small apps, no big deal. It works just fine, but anything bigger than 2 or those Todo mvc apps, no thanks.

  • @pasizdobrekuce
    @pasizdobrekuce 8 месяцев назад

    Client should be as "dumb" as possible. None of this makes sense and to me personally, frontend these days looks like flexing. I just feel kinda sorry for new devs coming into the industry.

  • @ivanmaglica264
    @ivanmaglica264 8 месяцев назад +2

    Btw, what the author proposed is actually a lot how oldschool AngularJS used to do things. You would include the AngluarJS in script section, define a template element, create a service that would hold some state, and bind it to the template html.

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      I am the author of this article. You should checkout EHTML

    • @guseynismayylov1945
      @guseynismayylov1945 4 месяца назад

      This idea is the core of EHTML framework/library.

  • @ivanmaglica264
    @ivanmaglica264 8 месяцев назад

    Redux turned me away from getting into React ecosystem every time since I first tried to get into it in 2017. I hear you don't need it anymore, maybe I'll give it another try.

  • @MehranGhamaty
    @MehranGhamaty 8 месяцев назад +1

    I feel like the issue with most modern frameworks being they let applications grow in a natural way.
    Using templates and traditional backend services without the need for dependencies generates understanding while developing.
    It's like leveling your way to max level instead of using an xp scroll. If you use the scroll you miss out on understanding how the skills work and lose the understanding of how to generate a "symphony". Like my embedded experience relates to writing linux components which relates to writing web servers which informs security and how to write large software projects. I can make a course graph if needed. The reason why "jumping into the deep end" is probably not a wise decision.

  • @hl7297
    @hl7297 9 месяцев назад +7

    Thanks for reminding me how good React is

    • @hl7297
      @hl7297 9 месяцев назад +3

      or any major frameworks.

  • @blue_mustang_
    @blue_mustang_ 8 месяцев назад

    2:51 Man that's a really bad practice , why he even put that on his article ? .You should use legit methods to convert a data type into another , not some crappy hack.

  • @internet4543
    @internet4543 7 месяцев назад

    He will quickly learn that his idea is not really an idea and that it is BS when he get's more expirience in building frontent libraries.

  • @zwparchman
    @zwparchman 7 месяцев назад

    Wow I actually invented this at a company that refused to allow us to use third party libraries. It was a decent solution imo

  • @analisamelojete1966
    @analisamelojete1966 5 месяцев назад

    Those sort of templates is what ERPs like Odoo uses for its fronted. Nothing else to say really.

  • @sebolio
    @sebolio 8 месяцев назад +1

    you can cast an int by just adding a plus sign before the string

  • @david23627
    @david23627 8 месяцев назад

    man, working with the mix of html and js its always be nasty, its just the web. Shit's weird

  • @Fik0n
    @Fik0n 4 месяца назад

    Still waiting for the template demo that shows how it allowed them to build better interactive user interfaces for the user and not the developer

  • @ahmedeox
    @ahmedeox 7 месяцев назад

    "Cast it to an int....ok, ok". Prime discovering yet another reason JS is shit

  • @gmp2474
    @gmp2474 9 месяцев назад +1

    Im surprised that a channel called Prime Reacts would even consider to read an article against reactivity.

  • @pxkqd
    @pxkqd 8 месяцев назад +1

    Always funny to see backend guys talking about frontend.

  • @michaelthorne455
    @michaelthorne455 8 месяцев назад

    Looks like a client side JavaServerPage or a Cold Fusion page. 😮

  • @guseynismayylov1945
    @guseynismayylov1945 4 месяца назад

    This idea is the core of EHTML framework/library.

  • @melonenlord2723
    @melonenlord2723 8 месяцев назад +1

    is there a reason not to do
    parseInt(button.getAttribute('data-Count'))
    ?
    Less to type? :D

    • @charlesbenca5357
      @charlesbenca5357 2 месяца назад

      try this:
      parseInt("0.00000005")
      parseInt(0.00000005)

  • @doubleg1094
    @doubleg1094 5 месяцев назад

    whatever *1 to avoid null/undefined --- this is the firs time i see it ! am from isnan era 🤣

  • @lucdina5118
    @lucdina5118 4 месяца назад

    The problem is not here, it’s more about security issues I’m using React

  • @sismith5427
    @sismith5427 8 месяцев назад +5

    Move to the Phoenix Framework and Liveview and all the js madness goes away, true server side state ... on the server, and handle updates via tiny websocket data calls to make the dom reactive. After 20 year writing JS... Liveview is just so much better

  • @statelessdev
    @statelessdev 9 месяцев назад +1

    4:54 Wrong. Global constants do not become properties of the window object, unlike var variables. You can confirm in in the browser in 2 seconds, have a look at window.constantYouSet - its not on there my guy.

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      It meant global in terms of scope, but you're right

  • @trainerprecious1218
    @trainerprecious1218 9 месяцев назад +7

    don’t you think it would be appropriate to say htmx is like this? instead of this is htmx? coz aren’t those built-in browser web environment?

  • @ChillAutos
    @ChillAutos 8 месяцев назад +1

    This is objectively terrible, but I learned something so nice article. We need more people like this in the world.

    • @guseynismayylov1945
      @guseynismayylov1945 8 месяцев назад

      I am the author of this article. If you want good use cases, check out EHTML

  • @Aguycalledmax
    @Aguycalledmax 7 месяцев назад

    I can’t imagine the sheer horror of a large codebase that has had 20 odd developers hacking pieces on to this over 4 years.
    “Global state is fine” is completely ignoring the realities of software development.