https://jsonplaceholder.typicode.com/usersYour key in the loop is changing. Every time the key changes react will see the component as different and unmounted it and remounted it.
thank you bruh! but I really wanted to know reason behind this. thanks again <3I don't know the answer to this. but i remember having a similar issue when i was learning react. I used hooks (useEffect) though. Ekenan empty array ekak pass karama it runs only once (even when state change)
store the response in your state variable only if it is different to the original value?
sorry. I'm at beginner level. I couldn't get what you told. but I delete the loop and only just fetched. but nothing is changed. if this is due to the key values, once I delete the loop it must be working neh?store the response in your state variable only if it is different to the original value?
meke tutorial eke me code ekama gahala thibbe. porage eke eka parai console.log enne?component eka deparak render wenawa. component eka athule monawa hari status wenasak unoth component eka aye render wenawa.
kohomath oya fetch wage dewal direct component athule use karana epa status management lib ekak harahama use karana
Solved. Youtube Video එකකින් හොයාගත්තේ. මේකේ Strict Mode Tag එක අයින් කරාම එක පාරයි Console Log වෙන්නේ. තෑන්ක්ස් හැමෝටම!
------ Post added on Dec 24, 2022 at 1:49 PM

typical sri lankan developer. strict mode remove karanna pissuda ban. potential bug ekak awoth identify karanne khomada. oka ohmama thiyapan production build ekata oken affect venne naTypical Sri Lankan Developer මමද උඹද බං? බලපන් මම මෙතන ප්රශ්නයක් ඇහුවම උඩ ඉන්න සුපිරි කොල්ලෝ ටිකක් උන්ගේ Perspective එකෙන් බලලා උත්තරේ දීලා තියෙනවා (@CodeMan , @SkullVamp , @හෙළයෙක් , @AlphaStigmatypical sri lankan developer. strict mode remove karanna pissuda ban. potential bug ekak awoth identify karanne khomada. oka ohmama thiyapan production build ekata oken affect venne na


). අනික මම කියලා තියෙනවා මම Beginner Level එකෙක් බුවෙක් කියලා. තාම මුල් හරියෙ ඉන්නේ. මේක Production Build එකට Affect වෙන්නේ නෑ කියන්න උඹ වගේ Senior Software Engineer (උඹේ රිප්ලයි එක දැක්කම මට එහෙම හිතුනේ 

) කෙනෙක් ගෙන් අදහසක් ඕනෙ නෑ මට. ඒක මම වගේ Beginner Level එකෙක්ට තේරෙනවා. මට ඕන වුණේ Behind the scenes Code එකේ වෙන්නේ මොකක්ද කියලා දැනගන්න මිසක් උඹලා වගේ Code එකක Unexpected දෙයක් Output වුණාම Production Build එකට Effect වෙනවද නැද්ද කියලා බලලා Effect වෙන්නේ නැත්නම් Code එක Use කරන ජාතියේ දෙකයි පනහේ Software Engineer කෙනෙක් වෙන්නේ නෙවේ. උඹේ Professionalism ගතිය උඹ රිප්ලයි එක දාපු හැටියෙන පේනවා මට. ආයෙ මිනිහෙක් දෙයකට උත්තරයක් ඇහුවම තමන් දන්න දේ ලොකු කරලා පෙන්නන්නේ නැතිව නිහතමානීව උත්තරයක් දීපන්. Coding වලට කලින් ඉගෙනගන්න දේවල් ගොඩක් උඹට තියෙනවා. යට පොටෝ එකයි උඹේ Professionalism ගතියෙයි කිසිම සම්බන්ධයක් නෑලු ඉතින්.