From 1dc30435ff2d860bd109067e47c2aabcfb55097a Mon Sep 17 00:00:00 2001 From: Pierre-Louis Guhur Date: Fri, 8 May 2020 11:47:14 +0200 Subject: [PATCH] fix(gform): context was not loaded switch back to a functional component useContext to load context add proptype --- src/components/banner/Gform.jsx | 38 +++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/components/banner/Gform.jsx b/src/components/banner/Gform.jsx index 1dec428..51adf15 100644 --- a/src/components/banner/Gform.jsx +++ b/src/components/banner/Gform.jsx @@ -1,22 +1,28 @@ -/* eslint react/prop-types: 0 */ -import React, { Component } from "react"; +import React, { useContext } from "react"; +import PropTypes from 'prop-types'; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faGoogleDrive } from "@fortawesome/free-brands-svg-icons"; +import { AppContext } from "../../AppContext" -class Gform extends Component { - render () { - return ( - - - Votre avis nous intéresse ! - - ); - } +const Gform = (props) => { + const context = useContext(AppContext); + console.log(context); + + return ( + + + Votre avis nous intéresse ! + + ); } +Gform.propTypes = { + className: PropTypes.string, +}; + export default Gform;