The Problem
In Reactjs
sometimes we have to display the string in multiline but it does not work in reactjs.
const [text, setText] = useState(`Some text \n next line`);
output
The Solution
For solving this problem we can use either React Fragment
tag or any valid JSX
tag.
const [text, setText] = useState(
<>
Some text <br /> next line
</>
);
output
If you find it helpfull please share with your network ✅.