In my react project, within a component, I want to include a npm module like so:
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test', {useNewUrlParser: true});
This does work in regular node js, react however shows a TypeError: mongoose.connect is not a function. Trying import mongoose from 'mongoose' returns a TypeError: mongoose__WEBPACK_IMPORTED_MODULE_4___default.a.connect is not a function.
How do I use npm packages in a react app? Do I need meteor (I've heard of it, but I don't understand what it does)?