From 9b427f086ab17659abf6cc247b001d40e9acac56 Mon Sep 17 00:00:00 2001 From: LordMathis Date: Thu, 31 Oct 2019 23:04:49 +0100 Subject: [PATCH] Pass config as prop --- src/components/Home.js | 14 +++++++++----- src/components/Navbar.js | 15 ++++++++++----- src/components/NotFoundPage.js | 2 +- src/components/Post.js | 5 +++-- src/containers/MainContainer.js | 7 ++++--- src/containers/PostContainer.js | 11 ++++++----- 6 files changed, 33 insertions(+), 21 deletions(-) diff --git a/src/components/Home.js b/src/components/Home.js index 3d82ea8..eb6d78f 100644 --- a/src/components/Home.js +++ b/src/components/Home.js @@ -1,17 +1,21 @@ import React, { Component } from 'react' import { Link } from 'react-router-dom' -import config from '../../config/config.json' +import PropTypes from 'prop-types' import '../stylesheets/globals.scss' import styles from './Home.scss' export default class Home extends Component { + static propTypes = { + config: PropTypes.object.isRequired + } + render () { let key = 0 - const objKeys = Object.keys(config.social) + const objKeys = Object.keys(this.props.config.social) const socialLinks = objKeys.map((val) => { const link = ( - +