I want to display a max of 13 words as a preview of what is written in each note, and if there is more text, then replace that text with three dots.
As an example: This is a user saved note and I'm limited to displaying thirteen words...
What I currently have is simply a full parsing of the JSON object no matter how large it is, however, I need to limit the length.
I have tried using Javascript string methods and did not succeed in making this work.
return (
<div className="notes">
<div className="notes_header">
<p>You have {numberOfNotes} notes</p>
</div>
<div>
{notes.map((val) => {
return <div key={val.id} onClick={() => Logic.selectNote(val.note, val.id)}><ReactQuill className="note" value={JSON.parse(val.note)} readOnly={true} /></div>
})}
</div>
</div>
)
}
This is the output after I parse val.note
0: {insert: "This is a user note.\n"}