Reputation: 31375
I have this textArea
input field for blogPost
text content that may contain multiline text, like:
This is paragraph one.
(empty line)
This is paragraph two.
I will display it (when loading the blogPosts
in my App) inside a <p>
tag with white-space: pre-wrap;
How should I save this to Cloud Firestore?
What I've got so far:
I'm thinking about saving as JSON.stringify(textareaValue);
How can I do this? Any better options?
Upvotes: 1
Views: 1614
Reputation: 317487
Cloud Firestore will store exactly what you send it. If you need the string to be something different at the time you render it on screen (like converting newlines to <br>
), then you will have to make those modifications yourself.
Upvotes: 2