TGViewer
Channel Public Channel
Diyorbek.dev | 👨🏻‍💻

Diyorbek.dev | 👨🏻‍💻

@diyorbekk_dev

Allohga taqvo qiling. Va Alloh sizga ilm beradi. [2:282]


Software engineer @ OctaneJS Core Team

Dasturchi, jiddiy, kamgap, oddiy inson


Òzim haqimda kòproq ma'lumot uchun: @Diyorbek_juraev_blog

Web sahifam: https://mrdiyorbek.uz/
Subscribers
381
Photos
299
Videos
35
Links
119

Showing posts older than #749 · Back to latest

Older Posts 15 shown
Post #747 94
Diyorbek.dev | 👨🏻‍💻 #Common_Beginner_Mistakes_with_React Question number: 2 Who can find the bug here? 😉 @Diyorbekk_dev
Answer

React
relies on an state variable's identity to tell when the state has changed. When we push an item into an array, we aren't changing that array's identity, and so React can't tell that the value has changed.

How to fix it: We need to create a brand new array. Here's solution

function handleAddItem(value) {
const nextItems = [...items, value];
setItems(nextItems);
}


@Diyorbekk_dev
Post #741 111
#Common_Beginner_Mistakes_with_React

Question number: 2

Who can find the bug here? 😉

@Diyorbekk_dev
  • ❤‍🔥 1
  • 👍 1
Post #740 95
Diyorbek.dev | 👨🏻‍💻 #Common_Beginner_Mistakes_with_React Question number: 1 Who can find the bug here? 😉 @Diyorbekk_dev
#answer

Question number: 1 [answer]

Our goal is to conditionally show a shopping list. If we have at least 1 item in the array, we should render a ShoppingList element. Otherwise, we shouldn't render anything.

And yet, we wind up with a random 0 in the UI!

This happens because items.length evaluates to 0. And since 0 is a falsy value in JavaScript, the && operator short-circuits, and the entire expression resolves to 0.

&& - false ni izlab yuradi.

@Diyorbekk_dev
  • 👍 1
  • 🔥 1
Post #738 98
#Common_Beginner_Mistakes_with_React

Question number: 1

Who can find the bug here? 😉

@Diyorbekk_dev
Post #733 116
https://t.me/CambridgeDiyorbekbot

Cambridge Diyorbekbotimni foydalanuvchilar soni (aktivlar) 609 ga yetibdi.

Agar foydalanuvchilarga foydasi tegayotgan bo‘lsa juda xursandman.

Chet eldan ham minnatdorchilik bildirib yozishgandi bu Telegram bo‘tim uchun.

Eng qizig‘i hech qanday reklamalarsiz shu natijaga keldi. 😅

@Diyorbekk_dev
  • ❤ 5
Post #730 120
Diyorbek.dev | 👨🏻‍💻 Difference between FastField and Field. FastField and Field are two popular form-building tools that can help you create custom forms for your business. While both tools have similar features, there are some key differences between them that you should be…
@Diyorbekk_dev
  • 👍 1
Post #729 122
Difference between FastField and Field.

FastField and Field are two popular form-building tools that can help you create custom forms for your business. While both tools have similar features, there are some key differences between them that you should be aware of.

One of the main differences between FastField and Field is their performance. FastField is optimized for large forms with more than 30 fields or fields that require expensive validation.

It has the same API as Field but implements shouldComponentUpdate() internally to block all additional re-renders unless there are direct updates to the relevant parts/slice of Formik state 1. Field, on the other hand, is independent of all other fields in your form and does not have any performance optimizations.

Another difference between FastField and Field is their support for photo fields. FastField has a Single Photo field that allows users to capture a single photo from their device’s photo library or camera and embed it into the form.

It also supports drawing overlays for annotation purposes, customizable image names for easier identification and context, as well as configuring quality and size settings so files are compressed prior to submission 2. Field, on the other hand, does not have any built-in support for photo fields.

@Diyorbekk_dev
  • 🔥 1
Post #727 121
#Experience

Qilayotgan projectlarimda dynamic form uchun odatda Formik ishlatardim.

Bugun FastField component va Field componentlarni farqini tushundim.

FastField bilan bòlgan muammoni solve qilishda anchagina vaqt ketdi.

Agar hohlasangiz alohida pòst tayorlayman.

Do you wanna learn about them? 😁

======> ✍

@Diyorbekk_dev
  • ✍ 7
Older posts →
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →