In the react project, you sometimes see the following errors:
Error: A cross-origin error was thrown. React doesn’t have access to the actual error object in development. See https://fb.me/react-crossorigin-error for more information.
In case of such an error message, first check whether you have such a code: JSON. Parse (xxx), which is mostly caused by this problem.
The corresponding processing method can use try catch to catch exceptions
try {
// You can interrupt the point to see that the execution has reported an error when you get here
let copyObj = JSON.parse(obj)
if (copyObj === null) {
return <span>-</span>
} else {
let str = ''
Object.keys(copyObj).forEach(
key => (str += key + ': ' + copyObj[key] + ',')
)
return str.slice(0, -1)
}
} catch (e) {
message.error('xxxx Parsing error')
return obj
}
Read More:
- A cross-origin error was thrown. React doesn‘t have access to the actual error object in development
- Solved: No’Access-Control-Allow-Origin’ cross-domain issue
- react Error: Objects are not valid as a React child (found: object with keys {username, password})
- An error is reported when using react app rewired to start the react project
- Cross origin requests are only supported for
- webstorm npm install –save –save-exact –loglevel error react react-dom react-scripts has failed.
- To solve the problem of NPM run eject error in react
- unable to access ‘https://github.com/facebook/react-devtools/‘:
- react Error: Unable to resolve module mobx-react
- Ajax error reporting cross domain, AJAX cross domain access error 501 solution
- Failed to load plugin react: cannot find module ‘eslint plugin react’ appears when running Vue project‘
- [W xx:xx:xx.xxx NotebookApp] 404 GET/static/components/react/react-dom.production.min.js (::1)
- How to Use the object of ES6 to clear the object value
- 【react】 tsconfig.json Configuration of react JSX error reporting solution in
- React Error: Minified React error #119
- Higher order components in react
- React bootstrap loading and how to use modules
- 【ipfs-api】npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
- Start react-native after updating Xcode11 and report an error: Unknown argument type ‘_attribute_’ in method -[RCTAppState getCurren
- How to solve the cross domain problem of Axios in Vue project