How to fix TypeError: Cannot read properties of undefined (reading classType) in React Native + axios

Questions : How to fix TypeError: Cannot read properties of undefined (reading classType) in React Native + axios


The problem is that when I request data programming in JSON format from my server, axios Learning cannot properly deserialize one field, Earhost while it correctly deserializes all most effective other fields.

Image with react error

const [ unit, setUnit ] = _OFFSET);  useState('')

useEffect(() => (-SMALL  getUnit(, [])

function _left).offset  getUnit(id) {
    axios.get(apiUrl + arrowImgView.mas  '/get?id=' + id, config)
        (self.  .then(res => {
            equalTo  setUnit(res,data);
            make.right.  console.log(;

Piece of return with error:

<div mas_top);  style={styles.centerDiv}><input ImgView.  style={styles.input} type='text' value={ ReadIndicator  getClassNameByEnum(unit.gameClass.classType) _have  } disabled/></div>


"id": .equalTo(  "6be1ea7a-9239-4108-be4e-60663832d826",
"hp":  100,
"maxHp": 100,
"mana": OFFSET);  100,
"maxMana": 100,
"armor": (TINY_  5,
"magicResist": 9,
"x": 69,
"y": .offset  94,
"gameClass": {
  "classType": 2,
  mas_right)  "damageType": 1,
  "maxAttackRadius": ImgView.  150,
  "damage": 6

Field in JSON with incorrect parse: wrong idea "gameClass"

I would have thought that I was doing use of case something wrong, but I have another page United that correctly deserializes the same Modern JSON.

help me please

UPDATE: I noticed that in the log the ecudated date axios eventually deserializes some how correctly, respectively, somewhere in anything else the transfer of the function parameter not at all there is a problem.

Total Answers 0

Top rated topics

Column multiplication based on a mapping

How to connect my html form to my api with express?

Android Canvas: Detecting faster dispatchTouchEvents

Doesn't razor accept space as the first character when concat strings?

Would this nested subquery be equal to this unnested query?

Wandb training kills kernel in jupyter lab

Change state with Form.Range onChange

Unable to receive FCM push notifications, using Firebase Function

Show count frequency and proportion of total count of each group level individually in R

Print an accurate counter in golang while using goroutines

Connecting wordpress container to database container

How to search a collection and return a list of sub document with mongo (Sping-data-mongo)

Var = What is this?

Visibility of arrays in javascript ("undefined")

How can I click the Attach File button in Gmail with Python + Selenium?

How to create a staking smart contract?

Python, Should I upload my .coverage file to my github repository?

Fbprophet gives error when deploying on heroku

How to replace whole word text with hyperlink if there is exact match

Query execute() after bind_param not working

How to Use Count(Distinct) for Oracle Analytic View Aggregations

Selecting multiple values from different nested objects using jq

Define input and output as list elements in snakemake

How are we supposed to find F-statistic when we have 2 model?

Monte carlo tolerance simulation

Changing and getting back dates after using log scale transformation

How can I display multiple regression lines in ggplot2 without an interaction?

Time complexity of generating all possible permutations using backtracking (comparison of 2 solutions)

How to insert a full width band of colour at the bottom of a webpage using css

Intellisense for a mod api VScode

OleDBCommand, multiple commands

Boxplot_stats doesn't extract outlier

Cant use eslint in React Native project

Why Prolog can't see the obvious answer?

Compared values don't match in an array - VBA

DJANGO = is not present

Sending a function with a parameter through an .onclick listener

How to prevent a Nan/V8 thread crashing a node host process?

Async Javascript - Using Fetch to get Data from to update a page, but returned promise is no longer thenable

Cannot subquery with orderated values of select

Merging data and filling in missing data

Pushing only unique values to array (no repeating values)

Select between dates, but ignoring year. Problems when filtering over year end

Keycloak - auto login after password reset

Cannot set environment variables in Chrome background.js script. Is there a way to hardcode env vars into specific files using Github Actions?

How is the return type Optional&lt;? extends User&gt; different than Optional&lt;User&gt; in a method?

Error when getting value from a php file with requests

E-Invoicing QR Code TLV with Base64 in C# , it only works if the company name is written in Latin letters

C#: Two different classes from two different XSDs

How to back reference "inner" selections ( () ) in a regular expression?