To setup my issue: I want to sort a text-document with regions of texts. the structure of data is:
{"words": ["Horn ", "Cirque ", "Glacier in Longitudinal Section "] }
{"words": ["my other ", "line ", "of texts"] }
inside an array. The result must be rendered in React using a webComponent for each sentence:
textContent.map((sentences, index) =>
<article>
<desc-sentence>{sentences}</desc-sentence>
</article>
)
textContent is the variable containing each sentence in regions.
but Objects are not valid as Children in react. An array is way recommanded, how to pass array with indexes ?
*Edit
the output shoud be
let textContent = [
{"words": ["Horn ", "Cirque ", "Glacier in Longitudinal Section "]},
{"words": ["V-shaped valley ", "carved by a river "]}
]
console.log(textContent[0].words);
<section>
<!-- inside the textContent loop of words-->
<article>
<p>{sentence}</p>
<p>{sentence}</p>
</article>
<article>
<p>{sentence}</p>
<p>{sentence}</p>
</article>
</section>
textContentsentenceslook like?<article> <p>Horn</p> <p>Cirque</p> <p>Glacier in Longitudinal Section</p> </article>?