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

147
Views
Render an array of HTML elements / objects to react

I'm trying to render an Array of HTML Objects in a react return statement.

var domObj = LCARS.create(nemesisUI).dom;

return domObj.map(({ id, className }) => {
    <div id={id} className={className}></div>;
});

The LCARS.create() method returns an array of the previously defined objects that looks similar to this: pastebin (the .dom element is at the bottom)

The .dom elements are created in an element-specific create method like

create: function (oDef) {
var element;
if (oDef.href !== undefined) {
  element = $('<a id="' + oDef.data.id + '" class="wrapper"></a>');
} else {
  element = $('<div id="' + oDef.data.id + '" class="wrapper"></div>');
}
return element;
}

This needs to be done because later, classes will be added or removed:

class: function (object, oValue) {
  for (var prop in oValue) {
    var bValue = oValue[prop];
    if (bValue === false) {
      object.dom.removeClass(prop);
      delete object.data.class[prop];
    } else if (bValue === true) {
      if (!object.data.class) {
        object.data.class = {};
      }
      object.dom.addClass(prop);
      object.data.class[prop] = true;
    }
  }

  return true;
}

The whole code for the "LCARS SDK" can be found here: GitHub

So at least the domObj.dom is an array of jQuery.fn.init(). When I try to render it with the code above, .dom is "0" and id and className is undefined.

I also tried returning domObj[0] or domObj directly, but then I get the error:

Error: Objects are not valid as a React child (found: [object HTMLDivElement]). If you meant to render a collection of children, use an array instead.

I really don't know how I can render these Objects respective the jQuery.Init things. I hope anybody can help.

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!