switch back to a functional component useContext to load context add proptypepull/73/head
parent
a1bab2ed73
commit
1dc30435ff
@ -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 (
|
||||
<a
|
||||
className={this.props.className}
|
||||
href={this.context.feedbackForm}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<FontAwesomeIcon icon={faGoogleDrive} className="mr-2" />
|
||||
Votre avis nous intéresse !
|
||||
</a>
|
||||
);
|
||||
}
|
||||
const Gform = (props) => {
|
||||
const context = useContext(AppContext);
|
||||
console.log(context);
|
||||
|
||||
return (
|
||||
<a
|
||||
className={props.className}
|
||||
href={context.feedbackForm}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<FontAwesomeIcon icon={faGoogleDrive} className="mr-2" />
|
||||
Votre avis nous intéresse !
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
Gform.propTypes = {
|
||||
className: PropTypes.string,
|
||||
};
|
||||
|
||||
export default Gform;
|
||||
|
Loading…
Reference in new issue