Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

193
Views
JSX is parsing before returning the data from a function in react Js

I am calling a function from the render method to fetch the updated data like this. but i am not getting the data on page because before getting the data my jsx is parsing . Here is my code

private fetchMessages = async () => {
const isArray = Array.isArray(this.props.messages);
let messagesData: any;

console.log(this.props.messages);
messagesData = this.props.messages;
if (!isArray) {
  const result = await this.props.messages.fetchByOffset({
    offset: null,
  });
  const results = result.results;
  messagesData = results.map((value: any) => {
    return value.data;
  });
}
return await messagesData;

};

in render function i am calling like this

 private getData() {
this.fetchMessages().then(messageResponse => {
  this.jetMessages = this.processCustomMessageArray(messageResponse);

  return new ArrayDataProvider<null, ojMessage.Message>(this.jetMessages);

});
return null;

}

render(props: Readonly<Props>): ComponentChild {
    this.jetMessagesDataprovider = this.getData();
    
    return (
      <div
        id={`${this.uid}_stickycontainer`}
        class="oj-sp-messages-banner-sticky-container"
      >
        <oj-messages
          id={`${this.uid}_messagecontainer`}
          messages={this.jetMessagesDataprovider}
          displayOptions={this.computedCategoryOption}
        >
          <template slot="messageTemplate" render={this.renderMessage} />
        </oj-messages>
      </div>
    );
  }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!