score:0
Accepted answer
React
sees below object
when it tries to render the result
in state
.
{
result: {
result: <your_data - res.data>
}
}
Try
{loading ? <ReactBootStrap.Spinner animation='grow' /> : result}
instead of
{loading ? <ReactBootStrap.Spinner animation='grow' /> : { result }}
React cannot render object
like { result }
And It will still fail since you wrap and save the result
as an object
.
Change
setResult({ result })
To
setResult(result)
This will still fail if res.data
is not a type of string
or array
of JSX
/string
Elements.
Source: stackoverflow.com
Related Query
- React Axios fetch response with error Objects are not valid as a React child
- Handling error in React with Formik: Objects are not valid as a React child
- I AM HAVING ERROR WHEN TRYING TO MAP A DATA IN REACT . Objects are not valid as a React child (found: object with keys {children}), How do i solve it?
- What is causing this error - Objects are not valid as a React child (found: object with keys {id, task})
- Objects are not valid as a React child with state while rendering error
- Trying to add an array of objects using react useState but getting the error 'Objects are not valid as a React child (found: object with keys {})'
- Passing an array of object to useState throws this error Objects are not valid as a React child (found: object with keys {id, name})
- React native - objects are not valid as a React child (found: object with keys {$$typeof, type, key, ref, props, _owner, _store})
- Objects are not valid as a React child (found: object with keys {})
- Objects are not valid as a React child getting error when adding div?
- Objects are not valid as a React child (found: object with keys {children}): ReactJS
- React.js Error: " Objects are not valid as a React child (found: object with keys {})."
- Error Objects are not valid as a React child (found: Invalid date)
- Objects are not valid as a React child with Styled components
- Objects are not valid as a React child (found: object with keys {username}). If you meant to render a collection of children, use an array instead
- Error: Objects are not valid as a React child (found: object with keys {id, name})
- Objects are not valid as a React child with React.memo
- Error: Objects are not valid as a React child (found: object with keys {}). If you meant to render a collection of children, use an array instead
- Error: Objects are not valid as a React child (found: object with keys {$$typeof, type, compare, WrappedComponent, displayName})
- Objects are not valid as a React child (found: object with keys {name}). If you meant to render a collection of children, use an array instead
- Error: Objects are not valid as a React child (found: object with keys {}). use an array instead
- Error: Objects are not valid as a React child (found: object with keys {})
- React with Router v5 Error: Objects are not valid as a React child (found: object with keys {children})
- React error saying Objects are not valid as react child
- Objects are not valid as a React child (found: object with keys {job}). If you meant to render a collection of children, use an array instead
- Objects are not valid as a React child error when giving value to react-select
- Objects are not valid as a React child (found: object with keys). If you meant to render a collection of children, use an array instead
- Objects are not valid as a React child (found: object with keys {children})
- 'Error: Objects are not valid as a React child (found: object with keys {results, info})'
- React setState error -> Objects are not valid as a React child
More Query from same tag
- index.js:1 Warning: Encountered two children with the same key, `index`. Index is unique
- ReactJS remove child element created through count
- React overrideing a function with = and => notation Issue
- Why react-testing-library is showing reference error
- Testing connected components with enzyme
- Ant Design add text only menu items
- React Accessing a value from an array
- Testing images imported in the component with Jest + React Native
- Heroku deployment successful for reactjs website but still shows "application error"
- Material UI select onChange doesn't work in react testing library
- Display items of array in subrow (react-table)
- sh is not a function in react after switch from zsh, then back to bash
- How to upload multiple images in Firebase 9 - React Js
- react bootstrap accordion plus minus indicators issue
- Strange behaviour in <header> tag in Meteor + React
- Cypress + Dom Testing Library: getByText does not find input's value
- onClick handler of react checkbox gives error
- Fetching data using API middleware taking an array of 3 action types, action.type is undefined in logger and state only updates once
- Is it possible to show warnings instead of errors on ALL of eslint rules?
- Getting Jest error TypeError: Cannot read properties of undefined (reading 'match') when using useParams in the component?
- Can“t access button value using material-ui
- Blank space under web page
- React Router Dom hitting wrong endpoint
- Reactjs, re-render same components, but different return data
- How can I display 2 charts side by side in react using material UI?
- How to type optionally empty objects
- Values with Redux-Form return null
- Why this map function is receiving object not string in react. I need to use item.item to render a string
- How can I update my circular progress according to my data in React JS?
- How to pass an input target value and setState values as parameters for a helper function?