Blog

Page 767 of my articles, tutorials, and thoughts

Latest Articles

Cover Image for Invalid Host Header when ngrok tries to connect to React dev server

Invalid Host Header when ngrok tries to connect to React dev server

Published on September 2, 2023

# Title: "🚧 Troubleshooting: Invalid Host Header when ngrok connects to React dev server 🚧" --- ### Introduction So, you're excited to test your awesome React application on a mobile device, but the moment you try to connect ngrok to the React dev ser

Cover Image for Push method in React Hooks (useState)?
javascript

Push method in React Hooks (useState)?

Published on September 2, 2023

# Understanding the Push Method in React Hooks (useState) 🔍 Are you confused about how to push an element inside an array when using the `useState` hook in React? 🤔 Don't worry! I'm here to guide you through it and provide easy solutions. Let's dive in!

Cover Image for Get viewport/window height in ReactJS
javascript

Get viewport/window height in ReactJS

Published on September 2, 2023

# 📱 How to Get Viewport/Window Height in ReactJS Have you ever wondered how to get the viewport height in ReactJS? 🤔 It's a common question, especially when you want to dynamically adjust the layout or elements based on the available space. In this blog

Cover Image for React PropTypes: Allow different types of PropTypes for one prop

React PropTypes: Allow different types of PropTypes for one prop

Published on September 2, 2023

# React PropTypes: Allow Different Types of PropTypes for One Prop 😎🔤💯 So, you have a React component that receives a prop called `size`. And you're wondering, can you let `React.PropTypes` know that this prop can be either a string or a number? 🤔 We

Cover Image for Nested routes with react router v4 / v5
javascript

Nested routes with react router v4 / v5

Published on September 2, 2023

# 📝 Easy peasy way to nest routes in React Router v4/v5 So you're working on a React app, and you want to organize your routes by nesting them. You've checked out the React Router v4 documentation, but you can't seem to get it working the way you want. D

Cover Image for How can I communicate between related react components?
javascript

How can I communicate between related react components?

Published on September 2, 2023

# How to Communicate Between Related React Components? 🗣️ So, you're diving into the amazing world of ReactJS and you've encountered a common challenge - how do you make related components interact with each other?! 😱 Fear not, my fellow React enthusia

Cover Image for to call onChange event after pressing Enter key
javascript

to call onChange event after pressing Enter key

Published on September 2, 2023

# Calling the onChange Event after pressing Enter Key in React So, you're new to Bootstrap and React and you're facing an issue where the onChange event is triggered as soon as you enter just one digit in the input field. This post will guide you through

Cover Image for React this.setState is not a function
javascript

React this.setState is not a function

Published on September 2, 2023

# Fixing the "this.setState is not a function" error in React If you're working with React and have encountered the error "TypeError: this.setState is not a function", you're not alone! This common issue often occurs when there is a problem with the bindi

Cover Image for How do you test for the non-existence of an element using jest and react-testing-library?
javascript

How do you test for the non-existence of an element using jest and react-testing-library?

Published on September 2, 2023

# ✨ Testing the Non-Existence of an Element in React with Jest and react-testing-library ✨ So you're writing unit tests for your component library using Jest and react-testing-library. 👩‍💻 Fantastic! But wait, there's a little challenge you've encounter

Blog | Matheus Mello