diff --git a/frontend/src/components/Header.js b/frontend/src/components/Header.js index f8f2f485..22f30a44 100644 --- a/frontend/src/components/Header.js +++ b/frontend/src/components/Header.js @@ -1,7 +1,9 @@ import React, { Component, PropTypes } from 'react' +import { objectWithoutProperties } from '../utils' const MapLink = props => { - const { show, linkText, href, linkClass, ...otherProps } = props + const { show, linkText, href, linkClass } = props + const otherProps = objectWithoutProperties(props, ['show', 'linkText', 'href', 'linkClass']) if (!show) { return null } diff --git a/frontend/src/utils/index.js b/frontend/src/utils/index.js new file mode 100644 index 00000000..1743b9b5 --- /dev/null +++ b/frontend/src/utils/index.js @@ -0,0 +1,9 @@ +export const objectWithoutProperties = (obj, keys) => { + const target = {} + for (let i in obj) { + if (keys.indexOf(i) !== -1) continue + if (!Object.prototype.hasOwnProperty.call(obj, i)) continue + target[i] = obj[i] + } + return target +}