score:2
this means that newsdata
is not an array. considering that you initialized it as an empty array (const [newsdata, setnewsdata] = usestate([]);
) i think that your problem is here:
setnewsdata(res)
res
is not an array.
to solve this you should set newsdata
as:
setnewsdata(res.data)
Source: stackoverflow.com
Related Query
- How to fix the type error Type '(string | Element) [] is not assignable to type 'string | Element | undefined' using react and typescript?
- How do I fix a React TypeScript error with the return value of useHotkeys hook not matching the type of the div element ref prop
- How to fix 'Hooks can only be called inside the body of a function component' error in React custom hook?
- How to fix Uncaught TypeError: Object(...) is not a function error when I connect Redux to the project
- How to fix the error type Item[] | undefined is not assignable to Item[] type using react and typescript?
- how to fix the error (is not a function) in react
- How to fix map is not function even there is already set data in the useState using React Hook
- How to fix the error react hook cannot be called inside a callback function using typescript and react?
- How to fix "TypeError: fsevents is not a constructor" react error
- How to fix nextCreate is not a function setting up useMemo setting up authentication react router and hooks
- How to fix '_react["default"].memo is not a function. (In '_react["default"].memo(connectFunction)' error in React native?
- How to fix TypeError _interopRequireDefault is not a function in Create React App
- How to fix the error 'alpha' is not exported from '@material-ui/core/styles' when using Skeleton in Material UI
- react js how to import only the required function from a file and not the all functions
- How to fix 'Expected the return value to be a 31-bit integer' error react hooks
- How to Fix "export 'React' (imported as 'React') was not found in 'react'" Error in React js
- How to fix "TypeError: categories.map is not a function" error in React
- how to solve the error that fs module is not found when used react and next.js
- How can I fix the error on my React App after trying to export a functional component?
- How to solve the error "this.props.myFunction" is not a function in react?
- How to fix 'library is not defined' error in my react app
- How to test React HOC function that is not passed into the wrapped component?
- How can I fix error message given by React Developper Tools on the default React page?
- Error with WEB3js - NodeJs.utils in vite react ts app - How to resolve TypeError: callbackify is not a function
- How to fix "Uncaught Error: Objects are not valid as a React child" when passing objects, obtained from the blockchain, to the children components
- Formik hooks "useField" throws error stating that the component is not a React function component
- How to fix "TypeError: Object(...) is not a function" when using a wrap function on React Component to authenticate user login with Browser Router
- How to fix "Response to preflight request doesn't pass access control check: It does not have HTTP ok status" error in react app with nodejs api
- how to fix eslint error 'pendo is not defined' in my react application
- How to detach mock function from the react component's prototype so that will not affect other test?
More Query from same tag
- How to show html entity using React?
- Example for Bubbling and Capturing in React.js
- Force props on functional component child
- How to deploy a ReactJS app built using Create-react-app on Linux?
- React this.setState is undefined inside handlechange
- Curtains Shader with react
- Updating Child Component Via Change of Props from Parent in React
- How to use new Feature Hooks in React?
- How can I transfer an information from child component to parent component React.js with React Router
- How to use API Keys stored in Google Firebase Cloud Functions
- How to clear local state after dispatching a success action in redux saga?
- CSS - animations for a carousel of multiple items
- Iam trying to update the state "Experience" but I didn't get updated value. please correct if my code is wrong
- Converting a class into const stateless function
- Passing a function works, but doesn't change the variable
- how to access refs array element
- MobX displaying previous query's results when this query errors
- Conditionally add attributes as result of nested function to React components
- React returning a function in a custom hook, whose internal hook returns an object
- for loop in react
- Can you add a button inside a custom TableCell in material UI?
- Why is console.log() showing react_devtools_backend.js:4049 instead of the file and line number?
- Opacity filter makes text less white, how can I fix it?
- Wrapper function for JSX elements, typed via generics
- TypeError: stripHtml is not a function
- How can I test form submit in React?
- How to change state of modal from a different component in react
- Reactjs: update specific row
- Passing value from callback in component to another component
- How to add bootstrap js in a Gatsby Website