score:3
react can be used with immutable or plain javascript data. and react does provide for a lifecycle hook(shouldcomponentupdate
) which you can choose to use in order to prevent re-render. however for a plain javascript data sometimes it can be an overhead to compare data and decide whether to re-render the data or not since it may so happen that in order to check for data change, you may need to deep compare the data and in cases where most often a re-render is needed, react has to make the dom updates after a comparison state which may be more costly then simple virtual dom diffing and updating.
that being said, you can achieve a tradeoff between a quick decision of whether to re-render or not actually rendering using a purecomponent
and/or immutablejs
data.
Source: stackoverflow.com
Related Query
- Why React does't compare Previous State and New State before re rendering? Why it always render when setState is called?
- Why is my state replacing my posts when I add a new one using React hooks and React context
- Why is there a delay in my React budget app in calculating a total, updating state with setState and then rendering it to the UI?
- Why my data is flickering between previous and new when state is updated in ReactJS?
- Why is my state beeing updated before i call setState with React Hooks and how do i fix the disabled mouse pointer?
- Compare previous state to new one in React Redux
- React redux shows previous state old data before fetching new data
- How to switch between object keys and clone the previous values before adding new values in react
- Set loading state before and after an action in a React class component
- Access old state to compare with new state inside useEffect react hook with custom hooks usePrevious
- Using redux, how to avoid rendering old state data before making a new API call?
- why should you clone react state before changing it or when working on it?
- How to maintain previous changed state in REACT JS as when new item is updated, previous is set to default?
- React useRef not updating and rendering new values
- React Redux - quick flash of previous state before dispatch issue
- REACT + REDUX: on redux state change mapStateToProps updating state but view is not rendering as per new state
- Taking React State (object of objects(example inside)) and getting an array of objects to map() for component rendering
- Why is initial state being set over and over again in the "useState" hook of react
- New to react and Redux, why am i getting an undefined store being passed?
- wrote a React code snippet to implement conditional rendering and am not able to update the state of {Left} and {Right}
- Usage of useCallback and setting new object state using previous state as argument
- How can I redirect to another component in react and pass the state that I set in the previous component?
- React JSX Dynamically changing the state of a component. Best practice and why
- Setting state inside promise and outside promise affects on rendering component in react
- Setting State and performing new Searches in React
- Why is React state the init state and not the state I just set?
- Why is my React rendering twice after my state is declared?
- How can I make react render the new state modifications after I have updated the state with hooks and context
- Creating and pushing new object into react state array
- Why is React rendering my component over and over with an unchanged state?
More Query from same tag
- JavaScript get index of last item in an array
- Error Exporting a component without importing
- How to make an image slightly off dialog in Material-UI
- onChange of Drop down semantic-ui not working
- Why is this child object empty, whatever i do?
- How to Remove the form value After Submit in React from below code?
- Module parse failed getting error in webpack
- How to remove local storage value only on initial loads of the component
- Immutable JS - Creating an OrderedMap from a List
- CSS: 3 or 4 columns depending on device orientation
- Configuring antdesign using webpack
- Are React Native macOS menu bar apps possible?
- React/Preact .map an icon that when clicked runs a function
- React Router v4 components with similar paths (fixed and dynamic path param) are "overlapping"
- Django (DRF) & React - Forbidden (CSRF cookie not set)
- Is there a better(cleaner) way to write this JS code using ternary operators(without repeating code)?
- React-Redux with Bootstrap -- modal component
- error message "undefined" when using Redux?
- trying to set value to context provider for a cypress test spec
- How to access env variables using react?
- Filter state array of data based on a unique key/name and push to a new Array
- NavLink needs to be active on two routes React-Router
- Execute function from properties in Javascript
- React useEffect not behaving as expected
- Initial values are not populating in React Form TextField
- ERROR: Failed to download Chromium r686378! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download
- In the process of React / Redux development, what is the proper way to install bootstrap?
- How to access complete object from a select field in react js
- How to access DOM event-handlers for JSX-components in server-sided React
- Why I am not able to fetch query into my fetch url?