I'm having trouble detecting line breaks coming from a text area. The standard .replace('↵', '\n') doesn't work, because by the time I call this.state.note the return characters have been respected.
From the console:
> this.state
{flashMessage: "", note: "one potato ↵two potato↵three potato↵four", showShareModal: false, isEditing: true}
> this.state.note
"one potato
two potato
three potato
four"
I've attempted to use encoudeURI and searching the string for '\n' - both with no luck.
Is there a way I can get the raw format of this.state.note?
notecome from? and what is the return character being replaced with?<a href:"mailto:...">It would be easy if I could detect any kind of return character and replace it with%0A. The note is attached to something likethis.props.userswhere I am iterating over all users that have an attached note.'\n'when you take the user input before saving it to the database?changeNote(e) { this.setState({ flashMessage: "", note: e.target.value }); }from the console if I drill down through the event, I can goe.target.defaultValueand see the return characters. But as soon as the state is set, they disappear.