Answer the question
In order to leave comments, you need to log in
How to pass value from object to div tag?
i have x object ,
const x = {
d: { D: 10 },
f: { F: 11 },
g: { G: 12 }
}
<div D={10} F={11} G={12} ></div>
Answer the question
In order to leave comments, you need to log in
const props = Object.values(x).reduce((result, item) => ({...result, ...item}), {});
<div {...props} />
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question