Data not loading

I’m using Firebase Realtime database to load some data, but I am loading the data to an innerHTML of a <span> element inside an owl carousel(“https://unpkg.com/swiper/swiper-bundle.min.js”) the data only loads when I click the left arrow of the carousel.I tested the problem with a <p>element and it loads instantly my loading code is:

How to set/access data object correctly using React with a Firebase database?

I’m having problems storing and accessing data with a useState hook in React after it is retrieved from a Firebase database. The problem seems to be stemming from the fact that not all users have all values in the playerData data packet – in this case, if the player has the ‘pioneer’ achievement, they can create a settlement, if not, they can only set their profile name (and in turn have an undefined settlementName within playerData). It works fine if the account has all of the relevant data, but if not then it hits a bunch of TypeErrors for null values.

Function can’t read useState parameters

I’m building an app with React Native and Firebase Realtime Database, when I start the function addItem the only parameter in the object that I get from the Database is the id, the other paramters return as '', I’ve tried using console.log() and the TextInputs work fine also I’ve used this configuration a lot of times and this is the first time it happens.