T
T
TheSnegok2022-04-04 17:45:39
React
TheSnegok, 2022-04-04 17:45:39

How to return jsx?

{MenuItems.forEach((item) => {
   for (let [headers, headersItems] of Object.entries(item)) {
     <div className={s.wrapperSections}>
        <img src={tile} alt={Object.entries(headersItems)[0][0]} />
        <span>{headers}</span>
   </div>
} 
})}

The data I need is displayed through the console, but as the elements are not created, what did I do wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2022-04-04
@TheSnegok

{MenuItems.map((item) => Object.entries(item).map(([headers, headersItems]) => (
    <div className={s.wrapperSections}>
        <img src={tile} alt={Object.entries(headersItems)[0][0]} />
        <span>{headers}</span>
   </div>
))}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question