diff --git a/lib/index.js b/lib/index.js index aa0846b..b6e9137 100644 --- a/lib/index.js +++ b/lib/index.js @@ -120,6 +120,13 @@ var Graph = function Graph(_ref) { var eventName = _Object$keys[_i]; network.current.on(eventName, events[eventName]); } + + return function () { + for (var _i2 = 0, _Object$keys2 = Object.keys(events); _i2 < _Object$keys2.length; _i2++) { + var _eventName = _Object$keys2[_i2]; + network.current.off(_eventName, events[_eventName]); + } + }; }, [events]); return /*#__PURE__*/_react["default"].createElement("div", { ref: container,