Fireship · @fireship

a solid start

Uploaded November 11, 2022 · Length 4:12

a solid start

Summary

solid start review: features, data fetching, and server-side code in a lightweight JavaScript framework

  • solid start
  • javascript framework
  • server-side rendering
  • data fetching
  • react alternative

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:01

    it is November 11 2022 and you're

  2. 0:04

    watching the code report no great

  3. 0:05

    JavaScript framework would be complete

  4. 0:07

    without its own meta framework for

  5. 0:09

    server-side rendering to go along with

  6. 0:10

    it react has next view has next angular

  7. 0:13

    has analog spelltas kit quick has City

  8. 0:16

    and as of yesterday solid has start as a

  9. 0:19

    late Comer to the JavaScript framework

  10. 0:20

    War it has the luxury of taking the best

  11. 0:22

    features from its peers and puts them

  12. 0:24

    together into one beautiful package and

  13. 0:26

    refreshingly it graciously gives all of

  14. 0:28

    them Credit in its announcement blog

  15. 0:30

    like when the Germans use mustard gas in

  16. 0:32

    World War one I don't seem to recall the

  17. 0:33

    French giving them any credit when they

  18. 0:35

    totally copied this game-changing

  19. 0:36

    blazingly deadly feature I think it says

  20. 0:38

    a lot about the team behind solid giving

  21. 0:40

    credit where credit is due but they've

  22. 0:41

    also done a lot of their own Innovation

  23. 0:43

    with a UI framework that's already very

  24. 0:45

    solid like other meta Frameworks it uses

  25. 0:47

    file system routing and supports nested

  26. 0:49

    layouts in the same way that nux does

  27. 0:51

    where a file can Shadow a directory that

  28. 0:53

    then has an outlet component that

  29. 0:54

    projects all the content from the

  30. 0:56

    subrouts this differs from next 13 which

  31. 0:58

    has a layout file for each of your

  32. 0:59

    layouts both nexjs and spell kit have a

  33. 1:02

    variety of naming conventions for the

  34. 1:03

    files in the routing system but one

  35. 1:05

    major criticism of this is that it leads

  36. 1:07

    to a bunch of files with the same name

  37. 1:09

    in your project like you'll have a

  38. 1:10

    hundred page.js files solid start takes

  39. 1:13

    the approach more like the old next JS

  40. 1:15

    where a file name will represent a route

  41. 1:16

    and it even takes things one step

  42. 1:18

    further where instead of having a bunch

  43. 1:19

    of index files you can wrap the file

  44. 1:21

    name in parentheses to give it a more

  45. 1:23

    descriptive name that's pretty cool but

  46. 1:25

    things get a lot more interesting when

  47. 1:26

    we start talking about data fetching

  48. 1:28

    like many other meta Frameworks you can

  49. 1:30

    export a function in this case called

  50. 1:32

    route data that can fetch data on the

  51. 1:34

    server or client when the user navigates

  52. 1:36

    to a new route what felt kind of weird

  53. 1:37

    at first to me was that you also need to

  54. 1:39

    use this create route data function that

  55. 1:41

    takes a callback that does the actual

  56. 1:43

    data fetching my initial thought was why

  57. 1:45

    not just simplify this API and return

  58. 1:46

    the data from the route data function

  59. 1:48

    but it turns out there's a good reason

  60. 1:50

    for this that will make sense in just a

  61. 1:51

    minute but first after we fetch this

  62. 1:53

    data we can then go into the UI

  63. 1:55

    component and access it with the use

  64. 1:57

    route data hook while providing us with

  65. 1:59

    end-to-end type safety now it doesn't