There seem to be an endless number of ways to write the same things in code, and React is no different —like writing functional components vs class components, putting your export statements before the component name or after the entire function…It’s very confusing when you’re first starting out!
Well, I’m here to show you yet another way of writing the same thing in a different way. But I promise hooks are worth the learning curve — they will make your code much cleaner and more readable.
So what are these hooks?
Hooks allow you to use state without writing class…
Getting started with testing
There are a ton of testing frameworks out there, and when you’re first learning code it’s tempting to ignore testing and just jump right in to the code. But testing can save you a lot of headaches down the road, especially when you’re building bigger applications or working with a team!
Cypress is an awesome open-source testing framework that has a lot of really cool built-in features:
1. Watch your tests execute in real time
2. Easily find and add test elements with the Selector Playground
Programming requires a lot of typing, but if you’re using Visual Studio Code as your editor, there are some really great keyboard shortcuts built in that can make your coding much more efficient.
*I’ll be showing the mac shortcuts here, but for windows users, just replace the ⌘ with Ctrl.
To look at all the options VS code has to offer, there’s actually a keyboard shortcut to see all the keyboard shortcuts —
see keyboard shortcuts: ⌘K ⌘S
…and you get:
Whoa! There are so many…you can read through them all if you’re into that kind of thing- or just…
If you’re new to Ruby (or any programming language), you may have come across these strange bits of coding when you search stack overflow for answers to life’s greatest questions — like how to count the number of sentences in a string:
You may be wondering — what is this code within a code?
It’s called Regex — short for Regular Expressions! It’s not unique to Ruby (many languages have some form of regex), but we’ll focus on Ruby’s version here.
Regex code is used for specifying a certain search pattern of characters to be matched in a string…