본문 바로가기

What I Read19

[ DEV / 번역 ] Fetch API, do you really know how to handle error? 원문 https://dev.to/dionarodrigues/fetch-api-do-you-really-know-how-to-handle-errors-2gj0?ref=dailydev Fetch API, do you really know how to handle errors? The Fetch API is not that new and most developers have used it at some point to retrieve resources... dev.to 밑에 코드는 콘솔에 어떤 메세지가 찍힐까? 성공? 실패? try { // this endpoint will return 404 const response = await fetch('https://restcountries.com/v4.1/all'.. 2023. 12. 13.
React Server Components - How and Why You Should Use Them in Your Code(2) Limitations of React Server Components Can't add any user interactivity to the server components like event handlers or react hooks Can't use Browser Web API like localstorage, bluetooth, web USB, and so on. Everything related to client interactions must continue to use client components. How to Use Client & Server Components Together Server components can import and render client components but.. 2023. 11. 21.
How to Improve Your ReactJS Code - Tips for Code Readability and Performance 1. Use Constants : 상수 사용하기 자바스크립트에서는, const 키워드를 통해 상수를 선언할 수 있다. 이것은, 같은 값을 재선언해주는 것을 방지해준다. 그래서 상수는 API keys나, 다른 비슷한 values를 저장하는데 유용하다. (API keys, URLs, Content) 모든 리액트 프로젝트에서, strings(content)을 하드코딩하는 건 지양해야한다/피해야한다. 이렇게 하면 UI, data, content를 서로 구분해줘서 프로젝트를 좀 더 유지보수성, 가독성, 확장성을 더 좋게 해준다. 많은 사이트들이 다양한 언어를 지원한다. 그래서 각각의 언어에 맞는 상수 파일이 있을 것이다. 상수 파일을 만드는 방법: 상수는 단순히 keys & values가 있는 자바스크립트 객체이.. 2023. 11. 19.
Is Your Code Slow? Avoid These 19 Common JavaScript and Node.js Mistakes ✔️ 읽기 전에 이 글은 제가 기록용으로 영어 원문을 요약해놓은 글 입니다. 설명이 부족하다고 느끼신다면, 링크를 통해 원문을 참고해주시면 좋을 것 같습니다. 1. Improper Variable Declarations and Scope => Declare variables locally inside functions whenever possible 2. Inefficient DOM Manipulation const ul = document.getElementById('list'); for (let i = 0; i < 10; i++) { const li = document.createElement('li'); li.textContent = i; ul.appendChild(li); } it is bette.. 2023. 11. 16.
React Server Components - How and Why You Should Use Them in Your Code(1) You can... Learn exactly what React Server Components (RSC) are, How RSC work, What problem RSC solve, Difference between React Server Components(RSC) and Server Side Rendering (SSR). React is an open source JS based library that helps web & mobile developers build applications that use a component-based architecture. state : the components' private data props : a way to pass data across other c.. 2023. 11. 16.
Web Animation Techniques - CSS vs JavaScript 원문 CSS Animations (Cascading Style Sheets) CSS is commonly used for styling web pages and animation Advantages of CSS Animations Easy to Use: relatively simple to implement Performance : they are hard-ware accelerated and generally perfom well, providing a smooth user experience. Responsive Design : they are inherently responsive ; adapt to different screen sizes and devices Low JS Overhead : re.. 2023. 11. 11.