I noticed that when I was upserting docs in mongodb the fields where not getting reset because the value coming in was undefined
instead of null
.
Pass a custom replacer
function to to JSON.stringify()
so when a value is undefined, we use null
instead.
const user = { name: 'Quirky', phone: undefined }; const replacer = (key, value) => (typeof value === 'undefined' ? null : value); const stringified = JSON.stringify(user, replacer); // -> "{\"name\":\"Quirky\",\"phone\":null}"
Install npm dependencies:
$ yarn install react-markdown remark-gfm react-frontmatter
Pass in the 2 plugins.
import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; import remarkFrontmatter from 'remark-frontmatter'; const markdown = `Just a link: https://reactjs.com.\n# Ola beaches.\n`; <ReactMarkdown remarkPlugins={[remarkGfm, remarkFrontmatter]}>{markdown}</ReactMarkdown>;
A paragraph with emphasis and strong importance.
Javascript Codeblock
import fake from 'some-npm'; console.log('Test JavaScript CodeBlock.');
A block quote with
strikethroughand a URL: https://reactjs.org.
Bacon ipsum dolor amet doner chislic cow ham hock andouille. Alcatra pork chuck, short loin pastrami meatloaf sirloin bacon capicola. Filet mignon shank jowl, tongue shankle ham hock meatloaf tail buffalo tenderloin capicola. Kevin flank ham hock, tongue andouille venison leberkas chicken beef sirloin. Turducken filet mignon porchetta cupim pancetta. Leberkas pork tenderloin doner.
a | b |
---|---|
test first column | test second column |
again | test again |
Test 1
Test 2