The "create react app" of Val Town

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ส.ค. 2024
  • Client-side react in 40 lines, no dependencies (besides react), explained in 10 minutes
    In the remaining 17 minutes i add ssr + client hydration
    I am just a boy, standing in front of react, asking it to render on the server and the client
    www.val.town/v...

ความคิดเห็น • 5

  • @iamanishkumar
    @iamanishkumar หลายเดือนก่อน +1

    val town is really really really great. I really cannot apprecite how much you gyus are providing for free.

  • @roguesherlock
    @roguesherlock หลายเดือนก่อน

    this is really cool!
    What I don't understand is how come browser doesn't throw a syntax error when loading the script. I believe browsers don't support jsx and it's technically part of javascript so shouldn't it throw syntax errors?

    • @ValDotTown
      @ValDotTown  หลายเดือนก่อน +1

      Thanks! Excellent question. We detect that the user agent making the request is a browser and returned transpiled javascript that can run in a browser. I try to explain that part here: th-cam.com/video/HyhsMd0CBnk/w-d-xo.htmlfeature=shared&t=411
      Here's a demo of the behavior: www.val.town/v/stevekrouse/esmTownTranspileDemo

    • @roguesherlock
      @roguesherlock หลายเดือนก่อน

      @@ValDotTown that makes sense. Initially I thought so too but I got confused cause if you directly load the file than it returns a text response (text/jsx).
      But looking at network tab now it does look like it returns a transpiled version when loaded from a script tag. I didn't know you could detect that. That's pretty neat actually!