refactor(nodes): wrap with memo, update transform without creatin new array #282

This commit is contained in:
moklick
2020-06-05 12:55:11 +02:00
parent d5997ecbea
commit 6b8e7bfbc3
5 changed files with 22 additions and 28 deletions
+3 -3
View File
@@ -1,15 +1,15 @@
import React from 'react';
import React, { memo } from 'react';
import Handle from '../../components/Handle';
import { NodeProps, Position } from '../../types';
const DefaultNode = ({ data, targetPosition = Position.Top, sourcePosition = Position.Bottom }: NodeProps) => (
const DefaultNode = memo(({ data, targetPosition = Position.Top, sourcePosition = Position.Bottom }: NodeProps) => (
<>
<Handle type="target" position={targetPosition} />
{data.label}
<Handle type="source" position={sourcePosition} />
</>
);
));
DefaultNode.displayName = 'DefaultNode';