score:1

D3.js v4 made breaking api changes. You're in version purgatory. You need to let go of v3 and embrace v4.

functions like d3.forceSimulation() are not available

Because you were trying to use a v4 function that doesn't exist in v3.

But new problem came out: Uncaught TypeError: Cannot read property 'append' of null, that means, svg.

Most likely it's because you're trying to use attr with an object, which v4 doesn't support out of the box.

You need https://github.com/d3/d3-selection-multi

Your import statement is correct.


Related Query

More Query from same tag