Skip to content

Commit

Permalink
Update gems; write a post (#18)
Browse files Browse the repository at this point in the history
Co-authored-by: Evan Freeman <efreeman@hubspot.com>
  • Loading branch information
EvanFreeman and efreeman-hubspot authored Dec 19, 2024
1 parent 0c3246d commit 1b36c06
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 36 deletions.
72 changes: 36 additions & 36 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,45 +1,46 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (5.2.6)
activesupport (5.2.8.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
autoprefixer-rails (10.3.3.0)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
autoprefixer-rails (10.4.13.0)
execjs (~> 2)
colorator (1.1.0)
concurrent-ruby (1.1.9)
em-websocket (0.5.2)
concurrent-ruby (1.2.2)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
ethon (0.15.0)
http_parser.rb (~> 0)
ethon (0.16.0)
ffi (>= 1.15.0)
eventmachine (1.2.7)
execjs (2.8.1)
extras (0.3.0)
forwardable-extended (~> 2.5)
fastimage (2.2.5)
ffi (1.15.4)
fastimage (2.2.6)
ffi (1.15.5)
forwardable-extended (2.6.0)
html-proofer (3.19.2)
html-proofer (4.4.3)
addressable (~> 2.3)
mercenary (~> 0.3)
nokogumbo (~> 2.0)
parallel (~> 1.3)
nokogiri (~> 1.13)
parallel (~> 1.10)
rainbow (~> 3.0)
typhoeus (~> 1.3)
yell (~> 2.0)
http_parser.rb (0.6.0)
i18n (0.9.5)
zeitwerk (~> 2.5)
http_parser.rb (0.8.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
jekyll (3.9.1)
jekyll (3.9.3)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 0.7)
i18n (>= 0.7, < 2)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 2.0)
kramdown (>= 1.17, < 3)
Expand Down Expand Up @@ -69,38 +70,36 @@ GEM
jekyll (>= 3.7, < 5.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.3.1)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
liquid (4.0.4)
liquid-tag-parser (1.9.0)
extras (~> 0.3)
liquid (>= 3.0, < 5.0)
listen (3.7.0)
listen (3.8.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.3.6)
mini_magick (4.11.0)
mini_portile2 (2.6.1)
minitest (5.14.4)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
mini_magick (4.12.0)
mini_portile2 (2.8.1)
minitest (5.17.0)
nokogiri (1.14.2)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogumbo (2.0.5)
nokogiri (~> 1.8, >= 1.8.4)
parallel (1.21.0)
parallel (1.22.1)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.6)
racc (1.6.0)
rack (2.2.3)
rainbow (3.0.0)
rb-fsevent (0.11.0)
public_suffix (5.0.1)
racc (1.6.2)
rack (2.2.6.3)
rainbow (3.1.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.5)
rouge (3.26.1)
rouge (3.30.0)
safe_yaml (1.0.5)
sass (3.7.4)
sass-listen (~> 4.0.0)
Expand All @@ -113,11 +112,12 @@ GEM
thread_safe (0.3.6)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (1.2.9)
tzinfo (1.2.11)
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
yell (2.2.2)
zeitwerk (2.6.7)

PLATFORMS
ruby
Expand All @@ -138,7 +138,7 @@ DEPENDENCIES
uglifier

RUBY VERSION
ruby 2.6.3p62
ruby 2.7.7p221

BUNDLED WITH
2.1.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
layout: post
title: "Introduction to TypeScript: Why Should You Use It for Your Next Project"
description: This article takes about what typescript is and why you should use it in your next project.
---

TypeScript is a popular open-source programming language that is a superset of JavaScript. It was developed by Microsoft and released in 2012. TypeScript adds optional static typing, classes, and interfaces to JavaScript, making it a more scalable and maintainable language.

In this blog post, we will explore the benefits of using TypeScript and why it is a great choice for your next project.

#### 1) Type Safety

One of the biggest advantages of using TypeScript is type safety. With TypeScript, you can catch errors during compile time rather than during runtime, which saves a lot of time and effort. You can catch type-related errors like undefined, null, or missing properties before deploying your code.

#### 2) Code Maintainability

TypeScript makes it easy to maintain and refactor codebases, especially for large-scale projects. As your project grows, it becomes more challenging to maintain your codebase, but TypeScript provides features like classes, interfaces, and modules to help structure your code. It helps to write better-organized, readable, and maintainable code.

#### 3) Improved Productivity

TypeScript makes coding faster and more efficient. With TypeScript, you get features like auto-completion, code highlighting, and better documentation, which makes coding easier and faster. You can easily navigate and understand the codebase, which improves productivity.

#### 4) Compatibility with Existing JavaScript Code

TypeScript is designed to be compatible with existing JavaScript code. You can start using TypeScript in your project without making any significant changes to your existing codebase. TypeScript is a superset of JavaScript, so you can still use all the features of JavaScript in your TypeScript code.

#### 5) Better Collaboration

TypeScript provides better collaboration between team members. Since TypeScript code is more structured and maintainable, it's easier for developers to work together. TypeScript also provides better documentation and error reporting, which makes it easier for developers to understand and fix issues.

#### Conclusion

TypeScript is a powerful programming language that adds static typing and other
features to JavaScript. It improves code maintainability, productivity, and
collaboration between team members. TypeScript also provides type safety, which
catches errors during compile time rather than during runtime. These benefits
make TypeScript a great choice for your next project.
44 changes: 44 additions & 0 deletions _posts/2024-12-18-controlled-inputs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
layout: post
title: "Taming the Text Fields: Mastering Controlled Inputs in React"
description: "Wrangle those rogue input fields in your React app with the Controlled Input pattern! This guide equips you to keep
user input under control, ensuring a smooth and secure development experience."
---


**Tired of rogue input fields running wild in your React app?** Enter the Controlled Input pattern, your knight in shining armor (or at least a well-organized React developer).

This pattern keeps your input fields in check by:

* **Storing the current value of the field in the component's state.** Think of it like a high-security vault for your user's precious keystrokes.
* **Using an event handler to update the state whenever the user types something new.** This keeps React informed and prevents any unauthorized changes.

**Why choose Controlled Inputs? It's like having a well-trained guard dog for your data:**

* **Predictable and Readable Code:** Everything is under React's control, making your code cleaner and easier to understand.
* **Dynamic Updates:** React instantly updates with the latest input, keeping your UI in sync and feeling responsive.
* **Easy Validation:** You can effortlessly check if the user's input meets your criteria before it wreaks havoc.

**Compared to Uncontrolled Inputs (the wild west of development):**

Uncontrolled inputs are like leaving the town gates wide open – anything goes! It's messy and unpredictable.

**So next time you need to handle input fields, choose the Controlled Input pattern and keep your React app safe and sound.**

This example code showcases the Controlled Input pattern in action:

{% highlight javascript %}
import React, { useState } from "react";

function ControlledInput() {
const [inputValue, setInputValue] = useState("");

const handleChange = (event) => {
setInputValue(event.target.value);
};

return <input type="text" value={inputValue} onChange={handleChange} />;
}
{% endhighlight %}

Let me know if you have any other questions about Controlled Inputs, or if you'd like to explore some other fun ways to manage your React components!

0 comments on commit 1b36c06

Please sign in to comment.