Relative Content

Tag Archive for reactjsjsx

React-Js State not updating in real time on a different page

I will try to keep it simple.
I have a list of todos which are displayed in a todo page.
I have a “number of todos” which are displayed on a home page.
I am trying to update in real time the “number of todos” when a user adds a new todos to the list.
My issue is that the state will not update until I refresh the “number of todos” home page. I want it to update in real time without the user having to refresh the page manually.
I am fairly new to react and not really sure what’s going on.

Invalid Hook call error inside react function component

I’m calling this Validation function from another component but when it hits the useState, I’m getting this error message…”Invalid hook call. Hooks can only be called inside of the body of a function component.”

Using as an input (in the sense of ) to edit content and post onto backend server

I am trying to use as an input (in the sense of ) to edit content and post the content onto the MySQL backend server by pressing the Save button. I prefer to retain the use because I want to the content to be style-formattable (bold, italic, bulleted lists, etc.). However, I am unable to do so unless I change to , which means I cannot keep the formatting options.

Having trouble setting up API call that requires a request json and parameters passed into the function it is in, please advise

I’m creating a reusable component function called ‘GetQuestion’ that will be called to get questions, scenarios and answer choices from a localhost Rest API that will require both an Exam ID and a Question ID within the request so it returns the correct data. I also want to be able to pass in the exam_id and question_id into this function and I am not sure on how to do that as well. I’m new at this and hope to learn from this groups wisdom, so please enlighten me to the best practices in your advice. Thank you in advance.
Regards,
Joe