Kedge, easy to use global state hook for React

Kedge adds new hook that feels and behaves a lot like except that it is shared globally.

Installation

npm install kedge

Usage

Previously, React state was an object that contained multiple properties describing the state of the component.

changed this. State is now a single value that represents a single property of the component. As such, components have multiple state objects.

The same principle applies to stores created with . Store is a single value and an application will most likely have more than one.

When creating stores, I recommend doing so in a centralized location.

# store.jsimport…


I don’t own a business. I don’t have business meetings. I don’t do “business”. I meet new people and have friends.

Giving out “business” cards feels shallow and superficial to me and I have always wanted to find a more personal way to connect.

Having conversations with someone is a great way to connect but exchanging contact information can disrupt that experience.

To solve these issues I don’t need a business card. I need a Personal Card.

I ordered a bunch of absolutely minimalistic business cards.


I don’t think Laravel needs any introduction at this point. Afterall, it is the most popular PHP framework.

This article assumes that you have already setup Homestead. If you have not, please read my previous article on the subject.

Notice

These instructions are specific to OS X. However, these concepts can be applied to other operating systems like Windows or Linux.

If you were to install Laravel from your local machine you might get an old version due to PHP being out of date. …


Regex is very powerful but it has a major flaw. It is a major pain to maintain.

The patterns you write may seem simple and easy to understand to you at this very moment but I absolutely guarantee you that someone (most likely you in 2 months) will spend way too much time breaking them down to understand what they do.

SQL deals with that problem by using natural language instead of specialized representation.

SRL is SQL for RegEx.

Take a look at this pattern.

/^(?:[0-9]|[a-z]|[\._%\+-])+(?:@)(?:[0-9]|[a-z]|[\.-])+(?:\.)[a-z]{2,}$/i

And the same thing in SRL.

begin with any of (digit, letter, one of "._%+-") once or more,
literally "@",
any of (digit, letter, one of ".-") once or more,
literally ".",
letter at least 2 times,
must end, case insensitive

Way simpler. Learn more here: https://simple-regex.com/


In this article, I will show you how PHP static methods, more often than not, result in coupled code that is hard to test. Certainly, it is possible to write clean, decoupled, maintainable and easy to test code using static methods. However, in the real world, I have never seen this. The amusing part about static methods is that the problems come up, not in these methods themselves but in the code calling them.

But first, let’s lay down some foundation.

Domain Layer

In short, the idea is to separate the business logic (domain) from the application logic (framework) as much as…


Here is a useful bookmarklet for TweetDeck users that clears all your columns in one go.

Unfortunately, Medium sucks for posting these. You have to copy the below code into a bookmark.

javascript:(function(){$.each(TD.controller.columnManager.getAll(),function(_,b){b.clear()})})();

Now that we have vagrant going we could set up the entire stack by hand using our favorite flavor of Linux. Or, we could just use a premade box that is ready to go with everything we might need. Say hello to Homestead.

Homestead is Laravel’s official Vagrant box. It comes preconfigured with a lot of tools you might need. It really makes things a lot easier and quicker.

Notice

These instructions are specific to OS X. However, these concepts can be applied to other operating systems like Windows or Linux.

To install Homestead, we will pull its Vagrant file from…


Before we write any code, we will set up a local development environment where we can run it and test it. Vagrant will help us do just that.

Vagrant is a tool that lets you easily spin up pre-configured development virtual machines. There are many reasons to use Vagrant but for the purpose of this course let’s just say that it is the recommended Laravel way. There is an official Vagrant box made specifically for Laravel development called Homestead. It integrates extremely well into the workflow and it has no lasting impact on your computer.

Notice

These instructions are specific to…

Matt Stypa

Calm work culture advocate. Open source contributor. Lead software engineer @ http://Neighborhoods.com

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