You should use local state i.e. useState as much as possible. Redux state should be the last resort. Only use Redux state if you absolutely need to pass data from one end of the application all the way to another end . This is both good practice for tight coupling and good performance.
Read moreWhat is React useState?
useState is a Hook that allows you to have state variables in functional components . You pass the initial state to this function and it returns a variable with the current state value (not necessarily the initial state) and another function to update this value.4 Ara 2020
Read moreuseState neden kullanılır?
useState () fonksiyonu aslında bir state hook. Bu hook’u, fonksiyon component’i içerisinde çağırıp içerisine istediğimiz state değişkenlerini atayabiliyoruz. Butona tıklanıp tekrar render edilme esnasında React bu state’i koruyor.
Read moreUse Layout effect nedir?
useLayoutEffect : Senkron çalışır ve tarayıcının yeni DOM’u paint etmesini engeler. DOM ile igili hesaplamalarda veya işlemlerde kullanılır.15 Oca 2020
Read moreReact Hooklar nelerdir?
React hooks bir class yazmadan react özelliklerini kullanmanıza olanak sağlayan bir yapıdır. React geliştiricilerinin hatırlayacağı üzere daha önce oluşturduğumuz class’ları react .component’ten extend ediyorduk ve bu sayede react özelliklerini kullanabiliyorduk.
Read moreComponentDidMount nedir?
ComponentDidMount . Komponent Dom’a render edildikten sonra çalışan Event’ımızdır. Yani render işleminden sonra çalışır. Not *=* ComponentDidMount ‘ta setState işlemi yapılırsa tekrardan Render işlemi yapılır.
Read moreSide Effect nedir React?
React ile daha önce geliştirme yaptıysanız; API kullanımlarınıda, subscribes ve DOM’un manuel olarak değiştirilmesi gibi işlemlere side effects denir. Çünkü bu tarz yan etkiye sahip işlemler rendering sırasında tamamlanmayabilir veya diğer bileşenlere etki etmesi gerekiyor olabilir.
Read more