score:1
Accepted answer
it seems that you are spreading a string instead of an array (household). this results in the string being separated into the individual characters.
making sure household is an array should do the trick.
to ensure this you could require the npm library "prop-types" which ensures that props have a specific format when passed into a component.
used like:
[componentname].proptypes = {
household: proptypes.arrayof(proptypes.string).isrequired
//... other props
}
if in the end not an array of strings but a string is passed you would get a console error, making it easier to understand what goes wrong
Source: stackoverflow.com
Related Query
- Spread operator in react is causing each character to be saved in it's own array, when updating in firebase
- React useEffect has a spread element in its dependency array
- React is rerendering my list even though each child in array has its unique key
- Navigate from parent to child in react where each component defines its own routes
- Replace element in array with in one line using spread operator in javascript react
- Stop Prettier formatter from putting each HTML tag on its own line in React JSX files?
- SetState in an array with React spread operator
- React Copy Array using Spread Operator Not working
- React state for array is not appended using spread operator
- I have an array state of my react component, should I use Object.assign() when I add new item? I tried spread operator but see strange behavior
- How to map an array of arrays into a JSX element in a react component, with each inner array having it's own clipPath
- How to pass several props in spread operator in react
- spread operator in react throwing error of Unexpected token
- Add object to the beginning of array using spread operator
- Spread operator in React .setState()
- React Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `App`
- React - Each child in an array or iterator should have a unique "key" prop
- How to wrap the initialisation of an array in its own useMemo() Hook?
- React/Redux - Add object to start of array using spread operator
- How to push into an array of object using the spread operator to a specific element
- Input field losing focus on each character type - react
- How can I get TypeScript to type-check the spread operator in React props?
- Spread operator with React Props in Typescript (error: ...could be instantiated with a different subtype of constraint {})
- React project - spread operator in node module unexpected token
- React : Firing a custom alert from multiple components using an existing component having its own styles
- spread operator (...) is creating extra fields in array in es6
- Does a React application HAVE to run on its own server process?
- Spread operator is not working in react typescript
- How to connect each element of array individually by using react redux
- Loop through array of file urls and download each one with React
More Query from same tag
- How can I store the data from scanning a QR code in an array using react?
- How to transpile node_modules folder using just babel 7?
- Module not found: Error: Can't resolve 'history/createBrowserHistory'
- How to redirect reactjs with this.props.history
- How can i get the min value and max value from the rc slider third party component
- REACT HOOKS - Passing JSON data (From API through Axios) into const
- Spring framework HttpMessageNotReadableException: Required request body is missing
- how to call useSelector Hook only when the data is available
- Floating AutoComplete in React Native
- Antd clear form after submit in reactjs
- jQuery Selectors with React is ok?
- Jest & Hooks : TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined
- Fetch response db.json is one object instead an array of objects
- React Redux Fast Update State
- React checkbox cannot reset to default unchecked state
- Update template variable from react panel plugin
- Custom URL in Vite dev server (multi page app)
- issue with react-router BrowserRouter in react with typescript?
- How to import node module or JavaScript file without webpack dependency when using create-react-app?
- ReactJS - values are returned undefined from a function with parameters
- ReactJs - Mapping props to state via async function
- How to useEffect pause setTimeout on handleMouseEnter event. Continue setTimeOout on handleMouseLeaveEvent?
- React useSelector hook Is it better to spread object or specify only needed fields
- How to reset input value after a button click that is not inside of a form in React.js
- Positioning Scroll Bar
- How to insert one component to another component onclick in reactjs?
- Material Table refreshes instead of appending onRowAdd
- Reset store after logout with Apollo client
- Performing jsx transforms on the client
- React function await not working. Executing at the same time