refactor(app): use memo fpr comps

This commit is contained in:
moklick
2019-07-25 15:16:59 +02:00
parent 3ecd00d027
commit bfeefd51b2
6 changed files with 19 additions and 21 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
import React, { useContext, useState } from 'react';
import React, { useContext, useState, memo } from 'react';
import ReactDraggable from 'react-draggable';
import { GraphContext } from '../GraphContext';
@@ -20,7 +20,7 @@ function getStartPositions(elements) {
}, {});
}
export default () => {
export default memo(() => {
const graphContext = useContext(GraphContext);
const [offset, setOffset] = useState({ x: 0, y: 0 });
const [startPositions, setStartPositions] = useState({});
@@ -79,4 +79,4 @@ export default () => {
</ReactDraggable>
</div>
);
};
});