How to update data to a reactjs website?

191


192 <Tabs onSelect={(index, label) => console.log(label + ’ selected’)}>
193
194

But I don’t know what is wrong here. Please explain. Thank you.

Sounds like label is an object instead of a string. You can probably stringify label with something like:

JSON.stringify(label)

See https://www.w3schools.com/js/js_json_stringify.asp for more details.

That will probably fix the warning, but now I don’t think that is the problem with the phone number. Can you check if the phone number is being loaded when you load the Edit Profile page? Maybe you could try logging the about and phone number and see what is displayed. It’s unclear if the problem is that the data is not coming from the database or if the problem is in displaying information that has been retrieved.

Where to place JSON.stringify(label); inProfile.js?

What do you mean? Well, I clicked on the Edit Profile button and typed my phone number and when I reloaded the page without clicking the update button, the phone number that I typed disappeared.

What do you mean about logging?

Why can’t I paste some codes and picture here? Something is wrong in this forum. Can you call the technical team to fix this bug?

Thank you.

Hi Lauren,

How is it?

I also have another question= I converted my Reactjs website into an Android app with a capacitor and when I run it, it only shows the website interface design. It can’t seem to connect to the mongod database because it didn’t show the profile picture and can’t login when I tried to login. How to fix this problem?

Thank you!

Lauren,

Around when will you respond?
Thanks.

Hi @jen,

While some users in the MongoDB Community have experience with React, I expect you’ll be able to get much better support for your questions around frontend development via one of the popular React discussion forums.

I recall that @andrew_w suggested a Discord community in one of your other discussion topics: Reset password link is not functioning. You mentioned you joined but didn’t get a reply yet, which is unfortunate but not uncommon for community discussions. Others are volunteering their time to help, and will not always be available, experienced, or enticed enough to look into every discussion.

A few tips that may help get you improved responses:

  • Since you have multiple files involved in your question, consider sharing a simplified Git repo or GitHub gist that someone can use to reproduce the problem you are seeing.

  • Include more context on your environment (for example your specific versions of React, Mongoose, and Node)

  • If you’re following a tutorial, modifying a demo app, or troubleshooting with documentation, include relevant links so others can follow the same path.

  • If your original problem is solved, start a new discussion topic for new issues. Separate topics with more focused discussion will help other users see where you are currently stuck and what solutions have been proposed or confirmed. In the MongoDB forum (and many others) you can also mark the most helpful post as a Solution.

A few learning strategies I would also consider are:

  • Find a tutorial or open source demo app that uses the same stack. You can use this as a reference or possibly even as a base for your own app (but definitely check the license if you plan to do so!).

  • Find (or pay) a mentor who can provide more dedicated time and assistance. There are likely user groups you could join (or start!) that will help with building community connections for peer support.

  • Explore MongoDB’s free online courses at MongoDB University and the many learning resources available via the MongoDB Developer Hub. For React resources I would start with the latest docs & tutorials provided on the reactjs.org site.

I appreciate it is frustrating to get stuck, but I hope some of those suggestions may help unblock your path.

Regards,
Stennie

2 Likes

Great suggestions, Stennie!

Jen - I don’t have experience with Android apps, so unfortunately I can’t provide any suggestions on that.

Hi Lauren,

Can you continue to help me about updating a phone number and can you answer my previous questions?=
Where to place JSON.stringify(label); inProfile.js?

What do you mean? Well, I clicked on the Edit Profile button and typed my phone number and when I reloaded the page without clicking the update button, the phone number that I typed disappeared.

What do you mean about logging?

Thank you!

Well now it looks like you’re getting into state management (with regards to the phone number) or storing values in local storage. Is this React? Lauren mentioned Android – are you using React Native? Your code looks like JS –
I should note that that is an edge case regarding saving a phone number when it was entered but the update button wasn’t clicked and page refreshed. It really is an anti-pattern to do something like that for several reasons both in UX and security purposes.

@Stennie makes some good suggestions on how to get help; trust me; I’ve been there more times than I care to admit—getting stuck and waiting for what feels like forever for an answer. The feeling of helplessness is awful.

Hi Andrew, I converted my Reactjs website into an Android app or web app and not a React Native.
I pasted my earlier message here for your reference=
Here is a screenshot of the Edit Profile page. At first, there is no ‘Phone number’ in the Edit Profile Page, but I have just added ‘Phone number’ in the Edit Profile page.

When I click on the Edit Profile button in the Profile Page, I can update info like ‘About Me’, ‘Password’ and also ‘Phone number’ which can also show the updated changes in my mongodb database. The ‘Phone number’ failed to display on the main Profile page here=
image

Thank you.

Hi Jen,

Regarding the JSON.stringify(label), I’d try replacing label with that on line 192.

As for logging, you could try using console.log() with the values of about and the phone number after you’ve connected to the database. It’s unclear if the problem is that the data is not coming from the database or if the problem is in displaying information that has been retrieved.

I’m not sure if I’m going to be able to help you much more on debugging this unfortunately. I recommend trying out some of the suggestions Stennie gave.

Hi Lauren,

How should I replace label with JSON.stringify(label) on line 192 = <Tabs onSelect={(index, label) => console.log(label + ’ selected’)}>?

I don’t understand about using console.log() with the values of about and the phone number after you’ve connected to the database. Can you give me a screenshot example about this?

Regarding the suggestions Stennie gave, however, my code is private. I can only show the code that has relevant with the cause of the problem. I give you time to help me debug this. :smiley: What do you want to know that can let you figure out the cause of the problem? Can we talk about this also via Discord?

Thank you!

Hi Jen - Unfortunately, I don’t think I’m going to be able to help you debug this anymore. Stennie provided some great suggestions for getting more help. I recommend trying those.

Hi Lauren,

Can you answer my questions?=
How should I replace label with JSON.stringify(label) on line 192 = <Tabs onSelect={(index, label) => console.log(label + ’ selected’)}>?

I don’t understand about using console.log() with the values of about and the phone number after you’ve connected to the database. Can you give me a screenshot example about this?

Thanks.

Hi @Jen,

Unfortunately, I think we’ve hit the limit of where this forum can help with the breadth of questions that you’ve raised here. I highly recommend reviewing @Stennie’s response above and exhausting some of those options to get you the help you’re looking for. Once you’ve nailed down some of the fundamental aspects of what you’re trying to build, we welcome you to repost specific MongoDB questions to the community here (note: please post an individual thread for each question so that folks can easily follow each discussion as we try to work through the issues together with you). We also welcome you to come back and share your learnings with the community as you make progress. We’re happy to celebrate wins together! For now, I am closing this thread.

Best,

Jamie
MongoDB Community Lead

2 Likes