manavkush
manavkush
TTCTheo's Typesafe Cult
Created by manavkush on 8/24/2023 in #questions
Preventing Rerender of Parent component in React
Hey All, This is my first post here. I'm building a project in React. I have a chat component, it has 2 subcomponents. I want to keep the messages state inside chat component. Subcomponents are: 1. Message List ( a components that takes in messages as props and lists them) 2. Input box ( a component that allows to add a new message to the messages array in the chat component. How do I prevent the chat component from rerendering when a new message is added and only allow the Message List component to rerender?
8 replies