You probably need to copy the objects:
export const initSelect = (data) => {
return data.map((item) => ({
...item,
selected: false
}));
}
More Related Contents:
- Handle response – SyntaxError: Unexpected end of input when using mode: ‘no-cors’
- How to avoid bind or inline arrow functions inside render method
- Make React useEffect hook not run on initial render
- React ‘cannot read property of undefined’ when using map
- How can I communicate between related react components?
- When to use functional setState
- How to pass data from a page to another page using react router
- How to call loading function with React useEffect only once
- Applying className/onClick/onChange not working on Custom React Component
- How to use componentWillMount() in React Hooks?
- Why is immutability so important (or needed) in JavaScript?
- Multiple path names for a same component in React Router
- How to access custom attributes from event object in React?
- this.setState isn’t merging states as I would expect
- setInterval in a React app
- Warning: Each child in a list should have a unique “key” prop even tho it has unique key React
- Can’t type in React input text field
- How to sync Redux state and url hash tag params
- Webpack output is empty object
- Single Page Application and CSRF Token
- Changing the layout of a component depending on Redux state
- What is useState() in React?
- Navigate to screen after opening a notification?
- When should you NOT use React memo?
- Service Worker registration error: Unsupported MIME type (‘text/html’)
- Proper way of using React hooks + WebSockets
- Programmatically change Redux-Form Field value
- How does event handlers with arrow functions achieve context binding
- Next.js, getStaticProps not working with component but does with page
- React-native view auto width by text inside