I just added Facebook Login(Javascript SDK) to my React App. The thing is when I added the Facebook API in componentDidMount, the webpage became very slow to load. So I tried a different method which is componentWillMount even though there was a deprecation warning. But it looked like changing the API call to componentWillMount dramatically improved the speed of loading.
Do you think there is a difference between componentWillMount and componentDidMount when it comes to website performance? And is it okay to use componentWillMount method? Or do you highly recommend componentDidMount?
class FacebookAuth extends Component {
UNSAFE_componentWillMount() {
window.fbAsyncInit = () => {
window.FB.init({
appId: "ID",
cookie: true,
xfbml: true,
version: "v4.0"
});
}}