This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import ChildComponent from "./ChildComponent"; | |
const ParentComponent = ({ open, data }) => ( | |
<> | |
<p>Some content to render</p> | |
{open && <ChildComponent open={open} data={data} />} | |
</> | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const data = [ | |
{ | |
name: 'Butters', | |
age: 3, | |
type: 'dog' | |
}, | |
{ | |
name: 'Lizzy', | |
age: 6, | |
type: 'dog' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { MongoClient } from 'mongodb'; | |
const DbConnection = function () { | |
var db = null; | |
var instance = 0; | |
async function DbConnect() { | |
try { | |
let url = 'mongodb://localhost:27017/articles'; |