Giving the user the ability to upload files to your application should be a tool all developers should have in their back pocket. Though it may seem easy in theory, there’s a lot of overhead that needs to be done to get your database and frontend setup for this type of information.

To start off, this is a guide for Rails as an API in the backend, and React.js in the frontend. First things first, when setting up your backend you’ll need to set up Active Storage so that your database can handle file uploads. It’s as simple as running:

rails…

Greetings reader, if you’re a newbie like me in the world of React then you’ve probably stumbled upon the conundrum of adjusting state outside of the parent component.

To start off, let’s get a good understanding of what state is. State in react is essentially;

“The state contains data specific to this component that may change over time. The state is user-defined, and it should be a plain JavaScript object.

If some value isn’t used for rendering or data flow (for example, a timer ID), you don’t have to put it in the state. …


Image for post
Image for post

Throughout your adventures in learning JavaScript you’ll eventually stumble upon the magical function called, ‘addEventListener.’ This function has an insane amount of power, and as far as my knowledge goes, it is the backbone of creating a web application. It may be tricky to know how to use this method to its highest potential. Advice that I can personally give is to use Bubbling. To explain what bubbling is; “The bubbling principle is simple. When an event happens on an element, it first runs the handlers on it, then on its parent, then all the way up on other ancestors.”(https://javascript.info/bubbling-and-capturing) To put this in laymen's terms. Bubbling is like, having a dart board with a sensor over the entire board. Therefore, every time a dart hits the board the sensor goes off. But, for this instance the dart board only cares about whether what you hit was a bullseye. So it runs some logic and asks itself ‘was that spot the bullseye?’, if not do nothing. But if it is, then add points, throw some confetti and party, because hitting a bullseye is something to celebrate about. …


And links

As a student learning their way around Ruby on Rails I’ve had many rough patches, but once I started learning how to maneuver around in the back end I wanted to create an efficient way for the user to maneuver around the front end!

Image for post
Image for post

As a beginner in the coding world we have many questions and an overwhelming amount of resources that we can learn from. Finding out the differences between buttons and links is too much, and that’s why you’re here.

Buttons are written like this:

           <%= button_to("button", path, method) %>

Let’s break this down. The begging of the button, before it even says “button_to” is an ERB tag. There are only three important ERB tags that a beginner should know about. …


I would like to preface this blog by stating I AM NEW TO CODING, oh and I AM NEW TO BLOGGING.

Coding is incredibly DRY(pun intended.) When I say that I mean, it’s just numbers and letters on a screen. There isn’t anything stimulating on the screen and for people like me that are visual learners, understanding material is incredibly difficult. I can’t learn what I can’t picture, therefore in my mind I have to ‘visualize’ what the code I’m writing does. For example, let’s take a Class (or a thing or an object) like Horses!

In code world, this is what it would look…

About

Ignas Butautas

An aspiring coder, trying to make sense of The World (of coding.)

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