Path To A Clean(er) React Architecture - API Layer & Data Transformations
DEV Community
by Johannes Kettmann
1h ago
The unopinionated nature of React is a two-edged sword: On the one hand you get freedom of choice. On the other hand many projects end up with a custom and often messy architecture. This article is the third part of a series about software architecture and React apps where we take a code base with lots of bad practices and refactor it step by step. Previously, we created the initial API layer and extracted fetch functions that can be used in the components. This way we already removed a lot of implementation details related to API requests from the UI code. But we’re not done yet. In this ar ..read more
Visit website
Implementing React `forwardRef` with TypeScript
DEV Community
by Hossain MD Athar
1h ago
React's forwardRef is a powerful feature that allows you to pass a ref through a component to one of its children. This is particularly useful when you're working with reusable components or when you need to interact with a DOM element directly. In this blog post, we'll explore how to implement forwardRef in React using TypeScript, focusing on a simple example of a text input component. What is forwardRef? Before we dive into the implementation, let's briefly explain what forwardRef does. When you use forwardRef, you can forward a ref to a child component. This means that you can access the un ..read more
Visit website
Monorepo Backend Application with Bundled Packages
DEV Community
by alony
1h ago
I spent hours searching and struggling to set up a server within a monorepo alongside private packages, trying various scripts and methods. Little did I know, the solution was right in front of me the whole time, simple and straightforward to implement. The frustrating part is, when you're working on a Next.js project within a monorepo, adding your module to the transpilePackages entry in the configuration is all it takes. However, for a backend applications with a custom build step, it's not as straightforward. I began by creating a monorepo using turbo with applications and packages. It took ..read more
Visit website
Why does the textarea rows count not decrease when content is removed?
DEV Community
by muflih1
1h ago
When I don't set the rows to state or textAreaRef.current.rows = calculatedRows, the console log properly increases and decreases the calculatedRows. However, as soon as I set the calculatedRows to the state or textAreaRef.current.rows = calculatedRows, it increases the rows but does not decrease them; it stays at the last calculatedRows. import React, { useState, useRef, useEffect } from "react"; import ReactDOM from "react-dom"; import styled from "styled-components"; const TextArea = styled.textarea` padding: 2px; resize: none; overflow-y: hidden; line-height: 1.5; `; function A ..read more
Visit website
Building Your First Browser Game with Three.js and React: Part 2 - Implementing 3D Models
DEV Community
by Romain
1h ago
Introduction Welcome back to our series on building a 3D basketball game in the browser! In Part 1, we set up our project with Vite and created a basic 3D scene with a cube. Today, we're adding key elements to our game: the basketball and the table (or hoop stand). By the end of this tutorial, you'll see these core game components come to life in our scene. Step 1: Preparing Your 3D Models Before we start coding, ensure you have the 3D models for the basketball and the table. We're using models prepared for Three.js (just created in Blender and exported in the right format), which are availabl ..read more
Visit website
Free Resources for UI Dvelopers | Free HTML Template
DEV Community
by Niraj Narkhede
1h ago
Are you a UI developer looking for free resources to enhance your projects? Look no further! In this blog post, we will be sharing some of the best free HTML templates available for download. Whether you're working on a personal project or a client's website, these templates are sure to make your job easier and more efficient. Let's dive in and discover the endless possibilities that await you! HTML5 UP: A collection of beautifully designed, responsive HTML5 templates perfect for modern websites. URL: https://html5up.net/ Templated: Offers a diverse selection of free HTML templates with cl ..read more
Visit website
Top Cyber Security Interview Questions and Answers for 2024
DEV Community
by Abid
1h ago
We offer Top 30 Cyber Security Interview Questions and Answers in below: Q1. What is cybersecurity? Ans: Cybersecurity is the practice of protecting computer systems, networks, and data from unauthorized access, cyber-attacks, and data breaches. Q2. What is the CIA triad? Ans: The CIA triad stands for Confidentiality, Integrity, and Availability. It is a foundational concept in cybersecurity, emphasizing the importance of ensuring that data is kept confidential, accurate, and available when needed. Q3. What is encryption? Ans: Encryption is the process of converting data into a coded form to ..read more
Visit website
Understanding the Importance of @Injectable in NestJS
DEV Community
by Ivor
1h ago
When we dive into the world of modern web development, especially with frameworks like NestJS, we encounter a lot of concepts that are both powerful and a bit complex to grasp at first. One of these concepts is Dependency Injection (DI), a design pattern used extensively in building scalable and easily maintainable applications. In NestJS, this pattern is beautifully simplified through the use of decorators like @Injectable. Let's explore how this little piece of code makes our development life easier. The Basics: What is @Injectable? In simple terms, when you annotate a class with @Injectable ..read more
Visit website
A doggerel rhyme to ensure you won't get confused by HTTP 301 and 302:
DEV Community
by graezykev
1h ago
Three-O-One, the permanent run; Three-O-Two, just passing through. 301 Moved Permanently: Imagine your favourite restaurant has moved to a new location. You know you won't find it at the old address anymore, so you update your address book and GPS to go directly to the new spot. It's like the restaurant has permanently changed its address. 302 Found (Moved Temporarily): picture a food truck that occasionally changes its parking spot. You might find it at one location today and another tomorrow. You keep checking the usual spot because you know it's just a temporary move ..read more
Visit website
Flask Essentials: Data Validation, Database Connectivity, and Crafting RESTful APIs
DEV Community
by Kuk Hoon Ryou
1h ago
Hello, beginners who are learning web development! In this post, we will explore what data validation is and why it's important. Additionally, we will implement data validation using Flask, a web framework in Python. We will also gradually learn how to integrate databases with Flask and validate data in RESTful APIs. What is Data Validation? Data validation is the process of checking whether the user-inputted data conforms to the desired format and conditions. For example, if you are receiving an email address in a user registration form, you need to check whether the inputted data actually fo ..read more
Visit website

Follow DEV Community on FeedSpot

Continue with Google
Continue with Apple
OR