Why is my "Hello World" disappearing after trying to connect to MongoDB in REACT?

So I created a new REACT app and trying to connect it to my collection from cluster0

I have a “Hello world” on port 3000, but as soon as I try to connect to MongoDB the “Hello world” from port 3000 disappears. What is going on?

I add the code below in my index.js from REACT in between the import section and the ReactDOM.render function. After adding the code below my port 3000 goes blank.

const mongoose = require("mongoose");


const partSchema = new mongoose.Schema({
  partN: "string",
  description: "string",

const Part = mongoose.model("Part", partSchema);