Page 1 of 1

Zeilenumbruch mit der .join-Methode

Posted: 20 Jan 2025, 18:35
by Guest
Ich bin neu bei ReactJS und versuche, beizutreten, was funktioniert, aber ich möchte nach jedem „Hallo Kontinent“ eine Pause einlegen.
und \n funktionieren nicht. Das br-Tag funktioniert in normalem JS, reagiert aber nicht.
Was ich suche, ist
Hallo Afrika
Hallo Amerika
usw.
Was ich bekomme, ist Hallo Afrika, Hallo Amerika usw.

Code: Select all

const continents = ['Africa','America','Asia','Australia','Europe'];
const helloContinents = Array.from(continents, c => `Hello ${c}!`);
const message = helloContinents.join("
");
const element = (

{message}

);