The goal of this blog post is to demonstrate how to create a React controlled form (i.e. form fields with value={someState} && onChange={handleChange}) which has a varying number of form inputs. Here is a GIF showcasing this behavior from a project I’m working on:

As you can see, a user is able to add form fields by clicking the “Add Wine” button, and remove specific form fields by clicking the minus button next to the field they wish to remove. It turns out this is a non-trivial feature to implement, and one which may have many different patterns. …

Beginner web developers have no idea how good we have it. One of our biggest problems is figuring out which free, high performance, open-source technology to leverage in pursuit of building our next project. We are so used to having this array of technologies at our fingertips that we sometimes miss the details of what they do for us and what problem they have solved. We spend our time atop a mountain of abstraction, writing very few lines of code for extremely exciting results.

One of these technologies is Node.js. As a beginner web developer myself I’ve noticed it can…

Preface: this walk-through was performed with Rails 6.1.1 and Ruby 2.6.1 on a machine running Linux. Steps should be identical for Windows using WSL, and I’ve noted a slight difference for those on Mac.

This feels like a walk-through that should exist on Rails Guides, and in fact, it does. Almost. This is not a dig on Rails Guides, which has undoubtedly saved many of us countless hours of scrounging for the right piece of documentation. In their own words (as of the time of writing this post) the Action Text guide is unfinished:

My goal is to simplify the…

You’ve spent a few weeks learning the basics of Ruby syntax; you can now iterate through nested data structures with ease, control flow of your program in response to varied user inputs, and you’re ready to figure out this Object Oriented Programming thing.

Ruby is, after all, an Object Oriented Programming (OOP) language. Many smarter and more knowledgeable people than me have described the paradigm that is OOP, so if you need a refresher on that before we move on to object relationships, I’ll direct you towards this excellently written tutorial by Saul Costa over at freeCodeCamp.

Fundamentally, relationships between…

Ben Swanson

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store