teleren/devto huggingface dataset:
Mastering React Re-Renders : The Key Prop Hack You Need to Know
Tags: react, frontend, javascript, webdev
Published: 2024-05-25 15:43:19

One of React's main features is its efficient re-rendering process. Unlike core JavaScript, which re-renders the entire DOM tree, React re-renders only the elements that have changed. A critical factor in this process is the **key** prop, which helps React identify which items need to be updated, added, or removed.

But did you know you can also force React to re-render a specific component using this prop? Interesting, right? Let's dive into how it works.

![Alt Text](https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExb2ttODJ3aTQ3ZWVkanB4bWQyeDdqZWJwMXBueWZucWc1ZWJudzNsZCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/3oKIPlLZEbEbacWqOc/giphy.gif)

## What is the Key Prop?
The **key** prop in React is usually assigned to list elements. It helps React track which elements have changed, need to be updated, or removed.

## Why Use Keys to Force Re-renders?
Sometimes, you might need to force a component to re-render, perhaps to reset its internal state or ensure it fully updates when receiving new props. Changing the **key** prop is a straightforward way to accomplish this because it tells React to treat the component as a new one, thus triggering a re-render.

## Example:
```JSX
import React, { useState } from 'react';

const ChildComponent = ({ key }) => {
  console.log('Child component rendered');
  return <div>Child Component</div>;
};

const ParentComponent = () => {
  const [key, setKey] = useState(1);

  const updateKey = () => {
    setKey(prevKey => prevKey + 1);
  };

  return (
    <div>
      <ChildComponent key={key} />
      <button onClick={updateKey}>Update Key</button>
    </div>
  );
};

export default ParentComponent;
```

## Detailed Code Walkthrough

![Alt Text](https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExcm1iajkzMzQ0Z3B5eTkyY25nZWRzNWdodnhxcHh3Y3hhNWI1eGRoYSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/3orieUe6ejxSFxYCXe/giphy.gif)

In this example, ParentComponent maintains a key state. The ChildComponent receives this key as a prop. Each time the button is clicked, the updateKey function increments the key, forcing ChildComponent to re-render.

## Common Use Cases
- **Resetting Component State:** When you need to reset a component's state under certain conditions.
- **Full Re-render with New Props:** Ensuring a component fully re-renders when it receives new props.
- **Managing Animations:** Triggering animations on mount/unmount by changing keys.

## Important Considerations
- **Key Uniqueness**: Ensure keys are unique among siblings to avoid unexpected behavior.
- **Performance**: Forcing re-renders by changing keys can be less efficient than updating components in place, so use this technique carefully.

## Conclusion
Using the **key** prop to force re-renders in React can be a powerful tool when used correctly. It provides a way to manage the component lifecycle and updates more precisely. Experiment with this technique to better understand how React handles rendering and component updates.
Dasturning arxitekturasi quyidagi chizma orqali tasvirlanadi:
Published: 2024-05-25 15:21:11

Dasturning arxitekturasi quyidagi chizma orqali tasvirlanadi:

Boshqaqa (User Interface): Dastur boshlanganida foydalanuvchiga xush kelibsiz xabarini chiqaradi va kerakli barcha ma'lumotlarni kiritishga yordam beradi.

Ma'lumotlarni qabul qilish (Data Input): Foydalanuvchi tomonidan kiritilgan rubl va dollar balanslari va amalga oshirilishi kerak bo'lgan valyuta miqdorlari kiritiladi.

Operatsiyani tanlash (Operation Selection): Foydalanuvchining tanlagan operatsiyasi (rublarni dollarga almashtirish yoki dollarni so'mga almashtirish) aniqlanadi.

Operatsiyani amalga oshirish (Operation Execution): Tanlangan operatsiya bajariladi. Agar foydalanuvchi rublarni dollarga almashtirishni tanlasa, miqdor mos kursga ko'ra hisoblanadi va boshqa valyutaga almashtiriladi. Agar foydalanuvchi dollarni so'mga almashtirishni tanlasa, kiritilgan miqdor usdToRub kursiga ko'ra hisoblanadi va so'mga o'tkaziladi.

Natijani ko'rsatish (Display Result): Amalga oshirilgan operatsiya natijasi va yangi balanslar foydalanuvchiga chiqariladi.

Dasturni to'xtatish (Program Termination): Foydalanuvchi dasturni tugatish uchun tugma bosishini kutish bilan dastur to'xtatiladi.

Ushbu chizma dasturning har bir qismi va faoliyati uchun birinchi sinfning (class) funksionalini ko'rsatadi. Dasturning umumiy arxitekturasi dastur yozuvining oson tushunarli va o'rganilishi uchun moslashtirilgan.
Pul miqdorini rubldan dollarga va aksincha o'zgartirishga va tranzaksiyadan so'ng balansni ko'rsatishga imkon beradi.
Published: 2024-05-25 15:14:35

Siz taqdim etgan kod oddiy C# konsol dasturi boʻlib, foydalanuvchiga pul miqdorini rubldan dollarga va aksincha oʻzgartirishga va tranzaksiyadan soʻng balansni koʻrsatishga imkon beradi.

Dastur arxitekturasiga kelsak, uni quyidagicha tavsiflash mumkin:

Loyiha tuzilmasi: Loyihada barcha dastur mantig'ini o'z ichiga olgan bir manba kod fayli, Program.cs mavjud.

Asosiy funktsiya Main: Bu dasturning asosiy kirish nuqtasi. U o'zgaruvchilarni e'lon qiladi, foydalanuvchiga xush kelibsiz xabarlar va ko'rsatmalarni ko'rsatadi va foydalanuvchi kiritishi va valyuta ayirboshlash operatsiyalarini bajaradi.

Kiritish/chiqarish uchun konsoldan foydalanish: Dastur foydalanuvchi bilan muloqot qilish uchun konsol kiritish va chiqishlaridan foydalanadi.

Istisnolarni ko'rib chiqish: Dastur foydalanuvchi kiritishi noto'g'ri bo'lishi mumkin bo'lgan vaziyatlarni (masalan, raqamli bo'lmagan qiymatlarni kiritish) ko'rib chiqishni ta'minlaydi.

Oddiy valyutani konvertatsiya qilish mantig'i: Dastur shunchaki joriy kurs bo'yicha pul miqdorini o'zgartiradi.

Shartli bayonotlar va almashtirish siklidan foydalanish: Dastur operatsiyasini tanlash uchun foydalanuvchi kiritgan qiymatni baholovchi va tegishli kod blokini bajaradigan switch operatoridan foydalaniladi.

Umuman olganda, ushbu dasturning arxitekturasi oddiy chiziqli boshqaruv oqimi bo'lib, unda axborot kiritiladi, ma'lum bir operatsiya bajariladi va natija chiqariladi. Ushbu kodda maxsus arxitektura modeli yoki dizayn namunasi mavjud emas, chunki dastur juda oddiy va cheklangan funktsiyalar to'plamini bajaradi.
A GAME IN JUST 30 MINUTES 😲 !!
Tags: webdev, javascript, beginners, tutorial
Published: 2024-05-25 15:12:19

I recently called @mince for a challenge .The challenge was simple. We just have to make a game in scratch and the time is 30min. This also has some points making

1 view in scratch - 1 point
1 heart- 2 points
1 star-2 points
1 remix- 3 points
1 comment -5 points

This is how we consider the points. The one who loses should praise the other person by writing a post in dev.to. I thought I should not lose this challenge with @mince 

## Starting
As I started the timer I felt nervous because I didn't have one game to do so I wasted literally 10minutes just thinking what should I do and after these 10 minutes I got a plan for my scratch game.

## Plan
My plan is easy. I have to create 100 GIGA'S of different colours and there will be one different GIGA just with a spectacles and if we find the odd GIGA among the 100 other we will get one point

## Implementing
The first thing I should keep in mind is I have 20 minutes and I did not write one line of code also. I first started by adding GIGA with spectacles and the starting page. The second I duplicated many GIGA's to make 100 GIGA's and wrote all of the code and the winning page. My game does not have anything to lose .In the last 5 minutes I did the score variable and ended my project and time was also over

## Please support me by giving a heart,star,remix and a comment so that I can win over @mince 
MY PROJECT: [FINDING GIGA](https://scratch.mit.edu/projects/1027030846/)
@mince project: [Pizza Clicker](https://scratch.mit.edu/projects/1027030846/)
OCBC | Found No Debit Card PIN for Applying One-Token while Signing in on a New Phone?
Published: 2024-05-25 15:10:42

1. In OCBC-SG app, tap "Log in to OCBC Singapore"
2. Input Access code and PIN (this is not the Debit Card PIN)
3. "Activate with SMS OTP and card PIN"
4. Step 1: Enter the SMS OTP sent to your mobile number
5. Step 2: tap "I do not have my card PIN"
6. tick "Request Token Key"
7. Confirm your mailing address (Note: Changing mailing address is not supported because while submitting the new mailing address on web personal banking, error would pop-up: "Sorry, you are not able to continue this transaction. Please activate OneToken by going to Manage OCBC OneToken in your Mobile device")

Since for overseas users, it will take about 3 weeks to receive this ordinary mail that contains your Debit Card PIN. Too Late.

Instead, after 2-3 working days, call Service Phone to ask the representative to send the PIN to your Secured Mailbox.

Don't worry, even without OneToken, you could still access your Secured Mailbox, by logging into OCBC app via Access Code, Access PIN and the OTP sent to your phone number.
конвертировать суммы денег из рублей в доллары и наоборот, и выводить баланс после операции.
Published: 2024-05-25 15:02:36

Код, который вы предоставили, представляет собой простую консольную программу на языке C#, которая позволяет пользователю конвертировать суммы денег из рублей в доллары и наоборот, и выводить баланс после операции.

Что касается архитектуры программы, она может быть описана следующим образом:

Структура проекта: Проект содержит один файл с исходным кодом Program.cs, в котором находится вся логика программы.

Главная функция Main: Это основная точка входа в программу. Здесь объявляются переменные, выводятся приветственные сообщения и инструкции для пользователя, а также обрабатывается ввод пользователя и выполнение операций обмена валюты.

Использование консоли для ввода-вывода: Программа использует консольный ввод и вывод для взаимодействия с пользователем.

Обработка исключений: В программе предусмотрена обработка ситуации, когда ввод пользователя может быть некорректным (например, ввод нечисловых значений).

Простая логика конвертации валюты: Программа просто конвертирует суммы денег по текущему курсу обмена.

Использование условных операторов и цикла switch: Для выбора операции программы используется оператор switch, который оценивает введенное пользователем значение и выполняет соответствующий блок кода.

В общем, архитектура этой программы представляет собой простой линейный поток управления, где вводится информация, выполняется определенная операция и выводится результат. В этом коде нет выделенной архитектурной модели или шаблона проектирования, так как программа довольно проста и выполняет ограниченный набор функций.
Top-Down Shooter Update: Day 1 (Player Done)
Published: 2024-05-25 14:58:06

Here you can see how amazing my art skills are for my main player:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lgd1ud8k4uwg9xksa1d9.png)

Not sure which direction the art will go in the future.. if you have any ideas, comment below
We all IT professional ignore Health. How Homeopathy help?
Published: 2024-05-25 14:37:36

**Understanding the Health Challenges of IT Engineers**
IT engineers often face unique health challenges due to the nature of their work, which involves long hours sitting at a desk, high levels of stress, and extensive screen time. Common issues include musculoskeletal problems, eye strain, headaches, digestive disorders, and stress-related conditions such as anxiety and insomnia.

**How Homeopathy Can Help**
[Homeopathy](https://drdevikapatelclinic.com/) provides a holistic and natural approach to managing these health issues. By considering the individual's overall well-being and specific symptoms, [homeopathic treatments](https://drdevikapatelclinic.com/) aim to stimulate the body's self-healing processes and restore balance.

**Common Health Issues**

1. Musculoskeletal Problems
2. Eye Strain
3. Headaches
4. Digestive Disorders
5. Stress and Anxiety
6. Insomnia

**Benefits of Homeopathic Treatment**

**Safe and Gentle:** Homeopathic remedies are highly diluted, making them safe for long-term use with minimal risk of side effects.
**Holistic Approach:** Homeopathy treats the whole person, considering physical, emotional, and mental health.
**Individualized Care:** Treatments are tailored to each person's unique symptoms and health history, ensuring personalized care.

[Click here for Consulting a Homeopathic Practitioner](https://drdevikapatelclinic.com/)
Is UIView (mostly) visible
Tags: swift, ios
Published: 2024-05-25 14:44:00

If you've ever needed to check whether a view is visible to the user, you might have used the `isHidden` property. However, this method falls short in scenarios where a view can appear hidden due to overlapping by other views. To address this, I created a simple extension to provide a more comprehensive visibility check.

```swift
extension UIView {

    /// Checkes if the view is (mostly) visible to user or not.
    /// Internaly it checks following things
    ///  - Should NOT be hidden
    ///  - Should NOT be completely transparent
    ///  - Bound should NOT be empty
    ///  - Should be in some window i.e. in view heirarchy
    ///  - Center should be directly visible to user i.e. NOT overlapped with other views
    var isMostlyVisible: Bool {
        guard !isHidden,
              alpha > 0,
              !bounds.isEmpty,
              let window,
              window.hitTest(window.convert(center, from: self.superview), with: nil) == self else {
            return false
        }

        return true
    }

}
```

Here is the extension in action:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h58pcd6cxrz1agasqrtm.gif)


Thank you for reading.
Discover Wit.ai: Create Your Own Intelligent Bots for Free 🚀🤖
Tags: javascript, ai, programming, machinelearning
Published: 2024-05-25 14:40:41

### Introduction
These days, most NLP stuff for development are either paid or have limited access. So last night I was working on a project, and I needed something like an NLP for my program. I casually started to browse the internet in search of such an NLP as a service, and I found [Wit.ai](https://wit.ai) by Meta. This post will provide a quick skim of what I know about it, trying to share the knowledge among my fellow developers!

### What is all this stuff?
So wit.ai is a powerful Natural Language Processing (NLP) platform, which enables you to create Natural Language Experiences, like chatbots or voice assistants for your projects, business, startup, company, whatever! Most importantly, it's free and open source. It is an alternative to DialogFlow by Google.
It is a natural language interface capable of turning users' sentences into structured data.  

![Wit.ai homepage](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ccy6shyepx24eljom6fn.png)



### How does Wit.ai work?
Wit.ai works with **Intents** and **Entities**:

- **Intents:** They represent the overall meaning or message of the sentence. For example, if a user asks for the price of some product, the intent can be "priceOfProduct"
- **Entities:** They provide additional information and context based on the user's message. They can be a word or a group of words referring to some specific information.


![Intents and Entities](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q8ihvphnvyafq28yqkjp.png)



Developers can teach the bot by providing example sentences, and the bot learns and improves with each interaction

There are a bunch of free resources online where you can learn more about how to use Wit.ai, and I'll be dropping some links at the end of this article.

### Using Wit.ai with your programs
Wit.ai provides API endpoints for several tasks, and you can use those to integrate them with your app or program.

Additional Links to Learn More 🚀:
[Wit.ai Official Documentation and Tutorials](https://wit.ai/docs/tutorials)
[An Informative Hands On Playlist On NLP chatbots and Wit.ai](https://www.youtube.com/watch?v=_RY1QUXjV10&list=PLYxzS__5yYQkptDjLxQVqvM1312YO32fq&pp=iAQB)
[Basic Tutorial For Using Wit.ai](https://youtu.be/cs_7uRICgrw?si=HWrOK8_h-GmFfnOp)
Top-Down Shooter Update: Day 1 (got distracted)
Published: 2024-05-25 14:39:28

My goal was creating the player, player script, and bullet.. well, slow to start.. I had to set up the Unity Project and downloading the Mobile Game 2D Core.. while it was loading I got distracted by redoing myitch.io profile and making a new game studio name and logo. 
What do you get distracted by, when trying to game dev?
I was thinking about a game studio name related to Albert Einstein since I've always kind of idolized him, like Relativity Interactive (I liked it, but didn't have that punch) or Space-Time Creations (I thought too basic). I settled on something I don't think has anything to do with the physics genius: QuantumByte Studios. 
Then, I quickly had DALL-E make a related logo since I'm not as artistic as many people on here. The program struggles with Text so it had to go through several iterations to not get weird letters (like M at one point was drawn as a pi symbol) or spelling mistakes:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o747l7bkhe2gpallbqfw.png)

Ok, the Unity Project and Mobile Game 2D Core is done, so I'm getting back to it.
✨New Animated UI Component Collection
Tags: tailwindcss, nextjs, react, ui
Published: 2024-05-25 14:39:23

#Hello everyone 😊
I know that I'm not alone and you also struggle with UI design (Especially if you are a backend developer) and THERE IS NOTHING BETTER for a developer mental health than prepared UI solutions that look AWSOOOMEEE ✨

So, I decided to drop some components on my personal website [https://ui.lukacho.com](ui.lukacho.com) which originally I made for myself. Every component is made with tailwindcss and reactjs.

I would like to share some of them in this article. Feel free to suggest me what should I upload next.

!!RADIX ALERT!! None of components use radix-ui

##Smooth Dropdown menu
Easy to implement, SMOOTH dropdown that uses only tailwind and framer-motion. [Link to Dropdown](https://ui.lukacho.com/components/dropdown-menu)
![Dropdown menu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2v10jemrdwi1x4spq512.gif)



When I say easy, I mean this easy
```tsx
import React from 'react'
import { Dropdown, Tabs, Tab, TriggerWrapper, Trigger } from './dropdown'
// just implement OurServices, Components and Blog, or copy from website
export const Dropdown = () => {
  return (
    <div className="flex h-96 w-full justify-start p-8 text-neutral-200 md:justify-center">
      <Dropdown>
        <TriggerWrapper>
          <Trigger>Our Services</Trigger>
          <Trigger>Components</Trigger>
          <Trigger>Blog</Trigger>
        </TriggerWrapper>
        <Tabs>
          <Tab>
            <OurServices />
          </Tab>
          <Tab>
            <Components />
          </Tab>
          <Tab>
            <Blog />
          </Tab>
        </Tabs>
      </Dropdown>
    </div>
  )
}
```


##Animated Chart
You can come up with cool use cases for this component. [Link to animated chart](https://ui.lukacho.com/components/animated-chart)
![Animated Chart](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jn3vv5dh840bb87tu5yv.gif)


##Custom Cursor
Cursor made With Framer-Motion. Link to [Custom cursor](https://ui.lukacho.com/components/custom-cursor)
![Custom Cursor](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k5f5lyulfbojvcx710v0.gif)


##Neo Brutalist Pricing Card
Actually, there are two of them) anyways, here's Link to [pricing card](https://ui.lukacho.com/components/animated-pricing-component)
![Pricing card](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1wqs2uexrw6emwkjneqq.gif)


If you want to see more, please checkout [website](https://ui.lukacho.com)

Don't forget to comment what would you like to see next!
CREATING A RESOURCE GROUP ON AZURE
Published: 2024-05-25 14:34:50

Firstly, sign in to the Azure portal, search for Resource Group and click on create. On the Basic bar consist of Project details with sub head "subscription" where all resources are billed together.
next is "resource group". type in a globally accepted unique name.

Next headings is the "Resource Details: with a sub title of the region/location. This is choosing a suitable Azure region.

Next to "Basic" is "Tag"  input name and tag your RG.

Lastly, click on "Review and Create" it will validates the process and once passed. click on create.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c6dpm64qf6nyiw611z8j.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tr8fx3wb0qgm9yyl09gz.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f2j28qzat6s03zdnkupb.png)
ytsftyutdsftdstyufds
Published: 2024-05-25 14:34:47

https://lkc.hp.com/forum/applications/phim-mai-hd-vietsub-thuyet-minh-mai-2024
https://lkc.hp.com/forum/applications/xemphimlau-mai-2024-full-hd-1080p-thuyetminh-vietsub
https://lkc.hp.com/forum/applications/xemphimlau-mai-2024-full-hd-thuyetminh-vietsub
https://lkc.hp.com/forum/applications/2024-1080phd
https://lkc.hp.com/forum/applications/2024hd-1080p
https://www.lesswrong.com/posts/QdHGKcsKh6WyxZYd6/tyghjyutjygjhgjggyuty
How and Why I Started My Career as a DevOps Engineer as a Fresher ( Accidental DevOps Engineer )
Tags: devops, developer, cloud, aws
Published: 2024-05-25 14:29:36

Don’t we all have our unique journeys that shape who we are today and who we aspire to be? Allow me to share my path to becoming a DevOps Engineer and my future aspirations. I hope you find it relatable and engaging. Feel free to share your thoughts and experiences; I'd love to hear about your journey too.

[Ujjwal Karn](https://lnkd.in/d9dgpchb)
Ann Otter Way To Secure Exchange
Tags: security, webdev, productivity, opensource
Published: 2024-05-25 14:24:08

## Prolog

Have you ever needed to send sensitive information, like a generated password, but felt uncomfortable transmitting it via email or MS Teams? The recipient doesn't have Threema, or you don't want the info in your personal chat history?

I've encountered this situation many times in the past. This need led me to create a small open-source tool. Feel free to use it or even improve it!

### My personal highlights of the project

💡 Simplicity and security are the main focus. The password is encrypted in the client's browser, and a URL for sharing is generated. The secret can only be retrieved once before it is permanently deleted.

💻 The tool is fully open-source, allowing everyone to analyze the code in detail. My goal was to create a lightweight yet security-oriented project.

🪅 Texts and logos can be customized as needed.

🚀 The system can be set up on any Docker-capable platform in just a few minutes.

I invite you to try out the application and look forward to your feedback!

You could find the project on Github: <https://github.com/daniiiol/AnnOtter.WayToSecureExchange>

## Development

The tool was deliberately written in vanilla JavaScript with minimal Bootstrap. The backend server is a small .NET 8 application, and the database system can either be an embedded SQLite database or a remote PostgreSQL DB.

I would be delighted if the hours invested in this application could benefit even more people, and I invite you to use the tool.

I invite you to try out the application and look forward to your feedback!

## Example

![Example of Secure Exchange](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2pm33edrq9kh2ouo3fg2.png)