DEV Community

Cover image for Dipping a toe in the waters of RedwoodJS
lmeromy
lmeromy

Posted on

Dipping a toe in the waters of RedwoodJS

Illustration by Katerina Limpitsouni, what an artist! https://undraw.co/

OK, I admit....I was initially excited about the release of RedwoodJS simply because of the name. I was born and raised in Northern California, and I think Redwood trees are really quite special. Tom Preston-Werner, the author of this new JAMstack framework, chose the name for similar reasons.

Recently, I have been considering which tools to use for my next side-project, and I though it would be fun to try a React-based static site generator since I use a lot of 'plain' React professionally. I had been considering Gatsby and a few other options, but for now I'll describe my brief foray into the Redwoods.

Overall Verdict: pretty cool!
Some folks may not like the fact that it is an opinionated framework and you cannot pick and choose your preferred technologies, but others will see that as a strength. I found this to be a good thing as I am still relatively new to software engineering and have plenty to learn in all areas.

The tutorial was great! It was a fabulous and very detailed introduction, it really goes from the very beginning to deploying a live site, and I learned a ton. Of the various technologies used in RedwoodJs, GraphQL and Netlify were the two completely new things for me....honestly I could not have defined what the GraphQL API was before. So I learned a bit about those too via hands-on experience and reading.

Other things I liked:

  • Automatically code-splits for great efficiency
  • A CDN (Content Delivery Network) is easy to set up even if you know very little about devops.
  • The short, technical explanations sprinkled throughout the tutorial were extremely helpful (e.g. server-side validation: when we need it and when the database takes care of it).
  • Scaffolds is a really slick bit of functionality which creates all the necessary pieces to perform CRUD actions on a given database table AND creates the various web components required to do all CRUD stuff from the UI. And all with a single yarn command.
  • Cells are a new abstraction used to fetch data in a declarative way (versus imperative). It is just a file which exports a GraphQL query, a 'Success' constant (which receives data following a successful GraphQL call), a 'Failure' constant to handle failures, 'Loading', and 'Empty'. Then these constants are available to pass to other React components to use however you want. The tricky, asynchronous stuff is abstracted away. Nifty!
  • Redwood is optimized for building web apps, so it fills a different space in the ecosystem compared to Gatsby and others like it.

Not as cool:

  • Because it is so new, there has not yet been time to grow a community of users and resources outside of the official docs (which are great for a start).
  • An opinionated framework like this is arguably great for beginners and/or developers who want to just go (which is one of the reasons the founder built RedwoodJS as heard in this pretty great episode of the Changelog JSParty podcast), but I also think there is a lot of value in going through and building and configuring things without a lot of frameworks (or any frameworks at all), especially at first so that people can understand how things all work together.

Questions I have:

  • Why is the default in the tutorial to leave out semi-colons at the end of a line of javascript? Is this no longer considered best practice in Javascript? What have I missed?
  • Why do the two default NotFoundPage.js and FatalErrorPage.js components have dangerouslySetInnerHTML? It doesn't seem so hard to me to just create the relevant content with jsx and a separate CSS/SCSS file as I'd do in any other React component?

Overall, I had a lot of fun, and I will definitely try building something beyond the tutorial! Have you tried playing around with RedwoodJS? What did you think? Can you answer my questions?

Top comments (3)

Collapse
 
shanemlk profile image
Shane Kunz

Thanks for sharing your thoughts. I'm mostly a Vue developer for professional stuff, not React. I tried Next.js and it was very cool, a little difficult though. I've been eyeing the Redwood docs. Maybe there's no harm in trying it. Based on your description, I'd probably like it a lot!

Collapse
 
pallymore profile image
Yurui Zhang • Edited

🎉 thanks for sharing!

For your first question - since the birth of StandardJS, there have been a pretty sizable community of JS developers who prefer writing code without semicolons. 😁

About dangerouslySetInnerHTML - well I haven't seen the code but my guess is they are using that to inject some CSS into a style tag. medium.learnreact.com/the-style-ta...

I'm interested in learning how RedwoodJS compares to Rails - Rails has inspired so many JS fullstack frameworks but so far none have come close.

Collapse
 
lmeromy profile image
lmeromy • Edited

Thanks for the answers!
Based on the author's background with Rails and some of the naming conventions, it probably has some Rails similarities. You'll have to let me know if you ever try it!