In most applications you will likely have user accounts. And if you do, you certainly want to limit what a particular user has access to. JSON Web Tokens is a popular method for providing user authorization across resources inside your application on the client-side.
When you send a normal fetch request to your backend, you typically send the
method of the request (GET, POST, etc) along with a
header object. Something like:
In React there are many ways of sharing data throughout your application. You can pass data as a prop from a parent component to a child component. You can use a third-party library such as Redux to globally store data in a container of sorts. A more modern way of sharing data is by utilizing React’s Context API.
The Context API allows your data to be available anywhere you need it inside your application. This is incredibly useful for situations in which multiple components must have access to the same data. You could pass this data down through multiple components until you arrive at the component that needs it. But of course, it is best to avoid prop drilling as it is inefficient and unnecessary. …
A recent software engineer coding interview question I was given was the following:
Check if a given string can be rearranged to form a palindrome. Return true or false.
A palindrome is a sequence of characters that reads the same backwards as it does forwards. So the question is asking if characters in the input string can be rearranged to from a string that reads backwards the same as it does forwards.
I had some difficulty understanding the question at first so here are some example input/outputs to clarify what the question is looking for:
Output: True =>…
If you built an app utilizing Rails ActionCable and you want to deploy it to Heroku, this short walkthrough is for you.
In the “Trailblaze” app I built with React/Rails, I implemented ActionCable in order to have a real-time chat feature. Getting the chat feature to work using WebSockets and ActionCable was somewhat difficult, but once I had it working in development there were some additional steps necessary to get the chat feature working in production. I was able to successfully deploy ActionCable to Heroku with the following steps:
Note: ActionCable subscribes and broadcasts from channels with Redis. Redis is an in-memory data structure used for data storage and caching in your app. Essentially, Redis keeps track of and syncs broadcasted content through ActionCable. Heroku requires a credit card on file but if you choose the nano version of Redis you won’t get charged but will be limited in data storage to 5MB. …
In order to secure sensitive information such as API keys from other people’s eyes, it is imperative that you hide them from your public repository. You do not want your keys visible in any of your public commits. There are simple processes you can take to hide sensitive information in both your React frontend application as well as your backend Rails application.
There is a very simple way to hide your API keys if you built your React application using
.envin the root of your React application.
create-react-app, the engine is able to read keys that start with
REACT_APP. Inside your
.envfile, add the following line:
During my first full build with React I ran into several issues that left me scratching my head for significant amounts of time. Some were common issues, and some were just particular to the application that I built. I want to share some of these hangups so that others may learn and grow from my frustrations. All of these issues were resolved by going down the rabbit hole that is debugging, along with tried and true Google searching.
The issues I want to discuss are as follows:
So here are the steps I went through to successfully deploy a Rails API backend to Heroku and a JS frontend to Github Pages, from a single repository.
brew tap heroku/brew && brew install heroku
All objects have a prototype property. This makes it possible for objects to inherit from other objects. This prototype property is what links one object to another. Through prototype chaining, changes to an object’s prototype can be seen by all objects if they are part of the chain.
In this prototype property, methods and properties are stored for which other objects can inherit from. When a property or method is called, the JS engine begins to locate that property or method. If it is not found, the search will move on and look for it in the object’s prototype. It will continue this cycle until it finds the property it’s looking for. If it can’t find it then the prototype chain eventually ends when an object has
null as it’s prototype (and
null doesn’t have a prototype). This ends the prototype chain. …
Single Page Application’s (SPA) are prevalent throughout modern web application development. The benefit of a SPA is that the page does not require reloading. This allows the user to interact with the application without virtually any downtime. When implemented correctly, the browser will always have content displayed even if a user click’s on a link on the page. Only a portion of the page will get rendered which provides seamless user interaction with minimal wait time.
Tarot reading is the practice of utilizing tarot cards to gain an understanding of the past, present, and/or future. Typically, a question is asked, cards are drawn, then an interpretation of the cards is provided. Tarot card reading has been around since the late 1700’s and now, over 200 years later, has gained popularity.
connecTarot is a web application built with Rails. It is designed to connect like-minded people together in the world of tarot. Users are able to track their own tarot readings, receive readings, and conduct readings for others. …