LiveWithPassion LiveWithPassion - 11 months ago 43
Node.js Question

How to rewrite this require module with import module syntax

I'm new to JavaScript and trying to import this module using ES6. It's currently written as:

var neo4j = require('neo4j-driver').v1;

I have:

import neo4j from 'neo4j-driver;'

But I have no idea how to handle the .v1?


Thank you.


Since v1 is a member of the module, you can use import's member syntaxes.

Including { member as alias }:

import { v1 as neo4j } from 'neo4j-driver';