<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Haruka Kato </title>
    <description>The latest articles on DEV Community by Haruka Kato  (@harukakato35).</description>
    <link>https://dev.to/harukakato35</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F546418%2F69bc52e6-ab00-4c91-83dc-653a516ee2e1.jpeg</url>
      <title>DEV Community: Haruka Kato </title>
      <link>https://dev.to/harukakato35</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/harukakato35"/>
    <language>en</language>
    <item>
      <title> How to use an array of colors to change the button background color on the button press using one handleChange (Hooks)</title>
      <dc:creator>Haruka Kato </dc:creator>
      <pubDate>Sat, 27 Feb 2021 02:10:24 +0000</pubDate>
      <link>https://dev.to/harukakato35/how-to-use-an-array-of-colors-to-change-the-button-background-color-on-the-button-press-using-one-handlechange-hooks-1jpl</link>
      <guid>https://dev.to/harukakato35/how-to-use-an-array-of-colors-to-change-the-button-background-color-on-the-button-press-using-one-handlechange-hooks-1jpl</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyxbnqem712yua89pgjhz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyxbnqem712yua89pgjhz.png" alt="Screen Shot 2021-02-27 at 10.34.52"&gt;&lt;/a&gt;&lt;br&gt;
I have 6 buttons and I wanted to change the color once pressed separately. &lt;/p&gt;

&lt;p&gt;At first, I decided to give useState to each button like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    const [color,setColor]=useState('#F5F5F5');
    const [textColor,setTextColor]=useState('black');
    const [color1,setColor1]=useState('#F5F5F5');
    const [textColor1,setTextColor1]=useState('black');
    const [color2,setColor2]=useState('#F5F5F5');
    const [textColor2,setTextColor2]=useState('black');
    const [color3,setColor3]=useState('#F5F5F5');
    const [textColor3,setTextColor3]=useState('black');


    const button = (
        &amp;lt;Button style={{background:color,color:textColor}}
                className={classes.paper}
                onClick={()=&amp;gt;{setColor("purple");setTextColor('white')
                }}&amp;gt;
            asda
        &amp;lt;/Button&amp;gt;
    )

    const button1 = (
        &amp;lt;Button style={{background:color1,color:textColor1}}
                className={classes.paper}
                onClick={()=&amp;gt;{setColor1("purple");setTextColor1('white')
                }}&amp;gt;
            asda
        &amp;lt;/Button&amp;gt;
    );


    const button2 = (
        &amp;lt;Button style={{background:color2,color:textColor2}}
                className={classes.paper}
                onClick={()=&amp;gt;{setColor2("purple");setTextColor2('white')
                }}&amp;gt;
            asda
        &amp;lt;/Button&amp;gt;
    );

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But then I thought if there is a way to use less useState, and I decided to use one useState instead of using 12 useState in total.&lt;/p&gt;

&lt;p&gt;I saw a lot of articles writing about updating multiple properties using one useState. But I did not see any article talking about updating the property by using an index.&lt;/p&gt;

&lt;p&gt;First, you want to create an array of color using one useState. White is the initial color of the buttons.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   const [colors, setColors] = React.useState([
        "white",
        "white",
        "white",
        "white",
        "white",
        "white"
    ]);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, you should create a function that has two arguments, index and value. I also had difficulties finding articles handleChange having two arguments. &lt;br&gt;
You can create a new object(newColors this time) to overwrite the existing values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    const handleChange = (index, value) =&amp;gt; {
        const newColors = [...colors];
        newColors[index] = value;
        setColors(newColors);
    };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;newColors[index] = value;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means the new colors will be passed to colors(The array we created before).&lt;br&gt;
For example, colors[0] = "purple".&lt;br&gt;
Finally, you pass the updated color to SetColors.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    &amp;lt;Button
                        style={{ background: colors[0] }}
                        className={classes.paper}
                        onClick={() =&amp;gt; handleChange(0, 'purple')}&amp;gt;
                        asda
                    &amp;lt;/Button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;JSX will be like this. You want to specify the index of colors in style, and update the color using handleChange.&lt;/p&gt;

&lt;p&gt;I have to tell you another thing here. I used onChange first to call handleChange and the background color didn't change. I found out that onChange doesn't work for some browsers, and you should use onClick. &lt;/p&gt;

&lt;p&gt;It took me a week to solve this problem and hope this is helpful for you.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, {useState} from 'react';
import { makeStyles } from '@material-ui/core/styles';
import { Link } from 'react-router-dom'
import Header from '../BasicComponents/Header';
import Footer from '../BasicComponents/Footer';
import Box from '@material-ui/core/Box';
import Button from '@material-ui/core/Button';
import Paper from '@material-ui/core/Paper';
import Grid from '@material-ui/core/Grid';


const useStyles = makeStyles((theme) =&amp;gt; ({
    root: {
        flexGrow: 1,
    },
    box:{
        position: 'relative',
    },
    button:{
        display: 'block',
        margin: '0 auto',
        marginBottom: 50,
        opacity: 0.7,
        height: 60,
        borderRadius: 50,
    },
    font:{
        textAlign: 'center',
    },
    paper: {
        textAlign: 'center',
        height: 100,
        margin:5,
        width: '100%',
        opacity: 0.7,
    },
    grid:{
        marginTop: 50,
        justifyContent: 'center',
        alignContent:  'center',
    },
    grid1:{
        justifyContent: 'center',
        alignContent:  'center',
        marginBottom: 50,
    },
}));

export default function Question2() {
    const classes = useStyles();

    const [colors, setColors] = React.useState([
        "white",
        "white",
        "white",
        "white",
        "white",
        "white"
    ]);
    const handleChange = (index, value) =&amp;gt; {
        const newColors = [...colors];
        newColors[index] = value;
        setColors(newColors);
    };


    const grid = (
        &amp;lt;div&amp;gt;
            &amp;lt;Grid container className={classes.grid} &amp;gt;
                &amp;lt;Grid item xs={6} sm={2} &amp;gt;
                    &amp;lt;Button
                        style={{ background: colors[0] }}
                        className={classes.paper}
                        onClick={() =&amp;gt; handleChange(0, 'purple')}&amp;gt;
                        asda
                    &amp;lt;/Button&amp;gt;
                &amp;lt;/Grid&amp;gt;
                &amp;lt;Grid item xs={6} sm={2}&amp;gt;
                    &amp;lt;Button
                        style={{ background: colors[1] }}
                        className={classes.paper}
                        onClick={() =&amp;gt; handleChange(1, 'purple')}&amp;gt;
                        asda
                    &amp;lt;/Button&amp;gt;
                &amp;lt;/Grid&amp;gt;
                &amp;lt;Grid item xs={6} sm={2}&amp;gt;
                    &amp;lt;Button
                        style={{ background: colors[2] }}
                        className={classes.paper}
                        onClick={() =&amp;gt; handleChange(2, 'purple')}&amp;gt;
                        asda
                    &amp;lt;/Button&amp;gt;
                &amp;lt;/Grid&amp;gt;
            &amp;lt;/Grid&amp;gt;
            &amp;lt;Grid container className={classes.grid1}&amp;gt;
                &amp;lt;Grid item xs={6} sm={2}&amp;gt;
                    &amp;lt;Button
                        style={{ background: colors[3] }}
                        className={classes.paper}
                        onClick={() =&amp;gt; handleChange(3, 'purple')}&amp;gt;
                        asda
                    &amp;lt;/Button&amp;gt;
                &amp;lt;/Grid&amp;gt;
                &amp;lt;Grid item xs={6} sm={2}&amp;gt;
                    &amp;lt;Button
                        style={{ background: colors[4] }}
                        className={classes.paper}
                        onClick={() =&amp;gt; handleChange(4, 'purple')}&amp;gt;
                        asda
                    &amp;lt;/Button&amp;gt;
                &amp;lt;/Grid&amp;gt;
                &amp;lt;Grid item xs={6} sm={2}&amp;gt;
                    &amp;lt;Button
                        style={{ background: colors[5] }}
                        className={classes.paper}
                        onClick={() =&amp;gt; handleChange(5, 'purple')}&amp;gt;
                        asda
                    &amp;lt;/Button&amp;gt;
                &amp;lt;/Grid&amp;gt;
            &amp;lt;/Grid&amp;gt;
        &amp;lt;/div&amp;gt;
    )

    return (
        &amp;lt;React.Fragment&amp;gt;
            &amp;lt;Header/&amp;gt;
            &amp;lt;Box
                className={classes.box}
                style={{
                    color: "#white"
                }}&amp;gt;
                &amp;lt;h2 className={classes.font}&amp;gt;Your customized stress release plan.&amp;lt;/h2&amp;gt;
                &amp;lt;p className={classes.font}&amp;gt;100% complete&amp;lt;/p&amp;gt;
                &amp;lt;h1 className={classes.font} &amp;gt;How did your stress change over the month?&amp;lt;/h1&amp;gt;
                &amp;lt;h3 className={classes.font}&amp;gt;Select all that apply(required)&amp;lt;/h3&amp;gt;
                {grid}
                &amp;lt;Button variant="contained" color="primary" disableElevation className={classes.button}&amp;gt;
                    &amp;lt;Link to="/result"&amp;gt;⇨　Go to next question&amp;lt;/Link&amp;gt;
                &amp;lt;/Button&amp;gt;
            &amp;lt;/Box&amp;gt;
            &amp;lt;Footer/&amp;gt;
        &amp;lt;/React.Fragment&amp;gt;
    );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>react</category>
    </item>
    <item>
      <title>How to place Grid in center in React </title>
      <dc:creator>Haruka Kato </dc:creator>
      <pubDate>Thu, 11 Feb 2021 01:45:15 +0000</pubDate>
      <link>https://dev.to/harukakato35/how-to-place-grid-in-center-4kpj</link>
      <guid>https://dev.to/harukakato35/how-to-place-grid-in-center-4kpj</guid>
      <description>&lt;p&gt;I was trying to center  element to center but&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;margin: 0 auto
display: block
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;nor&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;margin: 10px auto;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;worked. &lt;br&gt;
I researched and those solutions don't work for  because it a block-level element by default, and which therefore occupies 100% width as you can see from the picture. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XfHJKRrK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tkf7xbcxpu6uewkyxy4c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XfHJKRrK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tkf7xbcxpu6uewkyxy4c.png" alt="Screen Shot 2021-02-11 at 10.39.43"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is the code I was trying to apply.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    return (
        &amp;lt;React.Fragment&amp;gt;
            &amp;lt;Header/&amp;gt;
            &amp;lt;Box
                className={classes.box}
                style={{
                    color: "#white"
                }}&amp;gt;
                &amp;lt;h2 className={classes.font}&amp;gt;Your customized stress release plan.&amp;lt;/h2&amp;gt;
                &amp;lt;p className={classes.font}&amp;gt;20% complete&amp;lt;/p&amp;gt;
                &amp;lt;h1 className={classes.font} &amp;gt;How did your stress change over the month?&amp;lt;/h1&amp;gt;
                &amp;lt;h3 className={classes.font}&amp;gt;Select all that apply(required)&amp;lt;/h3&amp;gt;
                    &amp;lt;Grid container className={classes.grid} &amp;gt;
                        &amp;lt;Grid item xs={6} sm={2} &amp;gt;
                            &amp;lt;Paper className={classes.paper}&amp;gt;xs=6 sm=3&amp;lt;/Paper&amp;gt;
                        &amp;lt;/Grid&amp;gt;
                        &amp;lt;Grid item xs={6} sm={2}&amp;gt;
                            &amp;lt;Paper className={classes.paper}&amp;gt;xs=6 sm=3&amp;lt;/Paper&amp;gt;
                        &amp;lt;/Grid&amp;gt;
                        &amp;lt;Grid item xs={6} sm={2}&amp;gt;
                            &amp;lt;Paper className={classes.paper}&amp;gt;xs=6 sm=3&amp;lt;/Paper&amp;gt;
                        &amp;lt;/Grid&amp;gt;
                    &amp;lt;/Grid&amp;gt;
                    &amp;lt;Grid container &amp;gt;
                        &amp;lt;Grid item xs={6} sm={2}&amp;gt;
                            &amp;lt;Paper className={classes.paper}&amp;gt;xs=6 sm=3&amp;lt;/Paper&amp;gt;
                        &amp;lt;/Grid&amp;gt;
                        &amp;lt;Grid item xs={6} sm={2}&amp;gt;
                            &amp;lt;Paper className={classes.paper}&amp;gt;xs=6 sm=3&amp;lt;/Paper&amp;gt;
                        &amp;lt;/Grid&amp;gt;
                        &amp;lt;Grid item xs={6} sm={2}&amp;gt;
                            &amp;lt;Paper className={classes.paper}&amp;gt;xs=6 sm=3&amp;lt;/Paper&amp;gt;
                        &amp;lt;/Grid&amp;gt;
                    &amp;lt;/Grid&amp;gt;
                &amp;lt;Button variant="contained" color="primary" disableElevation className={classes.button}&amp;gt;
                    &amp;lt;Link to="/question2"&amp;gt;⇨　Go to questions&amp;lt;/Link&amp;gt;
                &amp;lt;/Button&amp;gt;
            &amp;lt;/Box&amp;gt;
            &amp;lt;Footer/&amp;gt;
        &amp;lt;/React.Fragment&amp;gt;
    );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You could use&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    margin: '0 auto',
    width: '50%',
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but in my case, it already specifies the width so applying this makes the grid smaller. &lt;/p&gt;

&lt;p&gt;So I used this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    grid:{
        justifyContent: 'center',
        alignContent:  'center',
    },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I hope this helps those who are trying to center Grid element. &lt;/p&gt;

</description>
      <category>css</category>
      <category>react</category>
    </item>
    <item>
      <title>Firebase Authentification using google sign-in OnAuthStateChanged logout </title>
      <dc:creator>Haruka Kato </dc:creator>
      <pubDate>Wed, 27 Jan 2021 01:50:34 +0000</pubDate>
      <link>https://dev.to/harukakato35/firebase-authentification-using-google-sign-in-onauthstatechanged-logout-5gpg</link>
      <guid>https://dev.to/harukakato35/firebase-authentification-using-google-sign-in-onauthstatechanged-logout-5gpg</guid>
      <description>&lt;p&gt;I was working on firebase authentification using google sign-in and a lot of articles online were explaining about Sign-in but there weren't many articles explaining logout. &lt;/p&gt;

&lt;p&gt;It took me a while to figure this out so I want to share it here. &lt;/p&gt;

&lt;p&gt;This is my directory structure. &lt;/p&gt;

&lt;p&gt;So first, you sign in with google on this page. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_w4Rx-NH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/78g63jwipy9kyetwwzz8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_w4Rx-NH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/78g63jwipy9kyetwwzz8.png" alt="Screen Shot 2021-01-27 at 10.30.04"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you successfully signed in, the logout button will show up on the header. &lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Eo5gqF0S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5j5cwom0v8g3q5skpnya.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Eo5gqF0S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5j5cwom0v8g3q5skpnya.png" alt="Screen Shot 2021-01-27 at 10.48.03"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, I wanted to show this logout button when a user is signed in. Here is my SignIn.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react';
import 'firebase/auth'
import { makeStyles } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
import Grid from '@material-ui/core/Grid';
import Header from './BasicComponents/Header';
import Footer from './BasicComponents/Footer';
import Button from '@material-ui/core/Button';
import { useFirebase } from "react-redux-firebase";
import { useDispatch, useSelector } from 'react-redux';
import { push } from 'connected-react-router'

const useStyles = makeStyles((theme) =&amp;gt; ({
    root: {
        flexGrow: 1,
    },
    paper: {
        textAlign: 'center',
        backgroundColor: '#C0C0C0',
        opacity: 0.7,
        borderRadius: 50,
        height: 500,
        paddingTop: 20,
    },
    grid: {
        position: 'block',
        margin: '0 auto',
        marginTop: 50,
        marginBottom: 50,
    },
    input:{
        width: '70%',
        height: 50,
        fontSize: 15,
        padding: '.3em',
        borderRadius: 10,
        border: '1px solid #aaa',
    },
    input1:{
        width: '70%',
        height: 50,
        fontSize: 15,
        padding: '.1em',
        marginRight: 5,
        borderRadius: 10,
        border: '1px solid #aaa',
    },
    p1:{
        textAlign: 'left',
        paddingLeft: 80,
        fontColor: 'black',
    },
    button1:{
        backgroundColor: 'pink',
        color: 'black',
        width: '35%',
        borderRadius:40,
        marginTop: 10,
    },
    button2:{
        backgroundColor: '#9400D3',
        color: 'black',
        width: '35%',
        borderRadius:40,
    },
}));


export default function SignIn() {
    const classes = useStyles();
    const auth = useSelector(state =&amp;gt; state.auth); //global stateを呼び出すため,Dev toolをみて決めてる
    const dispatch = useDispatch();
    const firebase = useFirebase();

    const signInWithGoogle = () =&amp;gt; {
        firebase
            .login({
                provider: "google",
                type: "popup",
            })
            .then(() =&amp;gt; {
                dispatch({ type: "USE_PROFILE" });
                dispatch(push('/top'));
            });
    };


    return (
        &amp;lt;div className={classes.root}&amp;gt;
            &amp;lt;Header/&amp;gt;
            &amp;lt;Grid &amp;gt;
                &amp;lt;Grid item xs={5} className={classes.grid}&amp;gt;
                    &amp;lt;Paper className={classes.paper}&amp;gt;
                        &amp;lt;form&amp;gt;
                            &amp;lt;h1&amp;gt;Welcome back!&amp;lt;/h1&amp;gt;
                            &amp;lt;p&amp;gt;Please sign in below to continue&amp;lt;/p&amp;gt;
                            &amp;lt;p className={classes.p1}&amp;gt;Email address&amp;lt;/p&amp;gt;
                            &amp;lt;input
                                type="text"
                                name="Email"
                                className={classes.input1}
                            /&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;
                            &amp;lt;p className={classes.p1}&amp;gt;Password&amp;lt;/p&amp;gt;
                            &amp;lt;input
                                type="password"
                                name="password"
                                className={classes.input}
                            /&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;
                            &amp;lt;Button classes={{root: classes.button1,}} type="submit"&amp;gt;
                                Sign in
                            &amp;lt;/Button&amp;gt;
                            &amp;lt;p&amp;gt;or&amp;lt;/p&amp;gt;
                            &amp;lt;Button classes={{root: classes.button2,}}
                                    onClick={(event) =&amp;gt; {
                                        event.preventDefault();
                                        signInWithGoogle();
                                    }} &amp;gt;
                                Sign in with Gmail
                            &amp;lt;/Button&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;
                            &amp;lt;p &amp;gt;Forgot Password?&amp;lt;/p&amp;gt;
                        &amp;lt;/form&amp;gt;
                    &amp;lt;/Paper&amp;gt;
                &amp;lt;/Grid&amp;gt;
            &amp;lt;/Grid&amp;gt;
            &amp;lt;Footer/&amp;gt;
        &amp;lt;/div&amp;gt;

    );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And here is my index.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import ReactDOM from 'react-dom';
import App from './App'
import { Provider } from 'react-redux';
import {configureStore} from './configureStore';
import firebase from "firebase/app";
import "firebase/auth";
import "firebase/firestore";
import { useHistory } from "react-router-dom";
import { createFirestoreInstance } from "redux-firestore";
import { BrowserRouter } from "react-router-dom";
import { useDispatch, useSelector } from 'react-redux';
import { ReactReduxFirebaseProvider } from "react-redux-firebase";
import { createStore, compose } from "redux";
import { rootReducer } from "./rootReducer";

  const firebaseConfig = {
    apiKey: "AIzaSyAOSBfTj_VQ4byWAAOWDhAsklmZtk2W_iE",
    authDomain: "stresstackle-599d9.firebaseapp.com",
    projectId: "stresstackle-599d9",
    storageBucket: "stresstackle-599d9.appspot.com",
    messagingSenderId: "930013144401",
    appId: "1:930013144401:web:79b25db79f4118359fdf70",
    measurementId: "G-J26Y6MYWV3"
  };

const rrfConfig = {
  userProfile: "users",
  useFirestoreForProfile: true,
};

firebase.initializeApp(firebaseConfig);
firebase.firestore();

export const auth = firebase.auth();

const initialState = {};
const store = createStore(rootReducer, initialState);

const rrfProps = {
  firebase,
  config: rrfConfig,
  dispatch: store.dispatch,
  createFirestoreInstance,
};

ReactDOM.render(
  &amp;lt;React.StrictMode&amp;gt;
    &amp;lt;Provider store={store}&amp;gt;
      &amp;lt;ReactReduxFirebaseProvider {...rrfProps}&amp;gt;
          &amp;lt;App /&amp;gt;
      &amp;lt;/ReactReduxFirebaseProvider&amp;gt;
    &amp;lt;/Provider&amp;gt;
  &amp;lt;/React.StrictMode&amp;gt;,
    document.getElementById('root')
    );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And App.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { Suspense } from 'react';
import { BrowserRouter as Router,Switch, Route} from 'react-router-dom';
import Top from './components/Top';
import Contact from './components/Contact';
import SignUp from './components/SignUp';
import SignIn from './components/SignIn';
import { ConnectedRouter } from 'connected-react-router';
import {history} from './configureStore';
import { Provider } from 'react-redux'
import {configureStore} from './configureStore';
const store = configureStore();

const App = () =&amp;gt; {


    return (
        &amp;lt;React.Fragment&amp;gt;
            &amp;lt;Provider store={store}&amp;gt;
                &amp;lt;ConnectedRouter history={history}&amp;gt;
                    &amp;lt;Switch&amp;gt;
                        &amp;lt;Route exact path="/" component={Top}/&amp;gt;
                    &amp;lt;/Switch&amp;gt;
                    &amp;lt;Switch&amp;gt;
                        &amp;lt;Route exact path="/contact" component={Contact}/&amp;gt;
                    &amp;lt;/Switch&amp;gt;
                    &amp;lt;Switch&amp;gt;
                        &amp;lt;Route exact path="/signup" component={SignUp}/&amp;gt;
                    &amp;lt;/Switch&amp;gt;
                    &amp;lt;Switch&amp;gt;
                        &amp;lt;Route exact path="/signin" component={SignIn}/&amp;gt;
                    &amp;lt;/Switch&amp;gt;

                    &amp;lt;Switch&amp;gt;
                        &amp;lt;Route exact path="/top" component={Top}/&amp;gt;
                    &amp;lt;/Switch&amp;gt;
                &amp;lt;/ConnectedRouter&amp;gt;
            &amp;lt;/Provider&amp;gt;
        &amp;lt;/React.Fragment&amp;gt;
    )

}
export default App;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I use Header.js file to show the logout button.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react'
import { makeStyles } from '@material-ui/core/styles';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';
import {push} from "connected-react-router";
import {useDispatch, useSelector} from "react-redux";
import { useState } from 'react';
import { useEffect } from 'react'
import firebase from "firebase/app";


const useStyles = makeStyles((theme) =&amp;gt; ({
  root: {
    flexGrow: 1,
  },
    appBar:{
      height: 90,
    },
    button:{
        fontSize:50,
        display: 'flex',
        justifyContent: 'space-between',
    },
}));

export default function Header({children}) {
  const classes = useStyles();
    const auth = useSelector(state =&amp;gt; state.auth); //global stateを呼び出すため,Dev toolをみて決めてる
    const dispatch = useDispatch();
    const [user, setUser] = useState(null);

    useEffect(() =&amp;gt; {
        return firebase.auth().onAuthStateChanged(user =&amp;gt; {
            setUser(user);
        });
    }, []);


    const logout = () =&amp;gt; {
        firebase
            .logout({
                provider: "google",
                type: "popup",
            })
            .then(() =&amp;gt; {
                dispatch({ type: "USE_PROFILE" });
                dispatch(push('/signin'));
            });
    };

    return (
            &amp;lt;React.Fragment&amp;gt;
                &amp;lt;div className={classes.root}&amp;gt;
                    &amp;lt;AppBar position="static" color='white' className={classes.appBar}&amp;gt;
                        &amp;lt;Toolbar className={classes.button}&amp;gt;
                            &amp;lt;p&amp;gt;ST&amp;lt;/p&amp;gt;
                            {user ? (
                                &amp;lt;button onClick={logout}&amp;gt;Google Logout&amp;lt;/button&amp;gt;
                            ) : (
                               &amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;
                            )}
                        &amp;lt;/Toolbar&amp;gt;
                    &amp;lt;/AppBar&amp;gt;
                &amp;lt;/div&amp;gt;
            &amp;lt;/React.Fragment&amp;gt;
        );
    }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, when a user is signed in, onAuthStateChanged changes from null. onAuthStateChanged is here to check if the state for user sign-in has changed or not.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    const [user, setUser] = useState(null);

    useEffect(() =&amp;gt; {
        return firebase.auth().onAuthStateChanged(user =&amp;gt; {
            setUser(user);
        });
    }, []);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a user signed in,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   const logout = () =&amp;gt; {
        firebase
            .logout({
                provider: "google",
                type: "popup",
            })
            .then(() =&amp;gt; {
                dispatch({ type: "USE_PROFILE" });
                dispatch(push('/signin'));
            });
    };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This function is called and my header will show the logout button. A lot of articles I found were doing way complicated things so it took time for me to figure this out. And I felt like Firebase official document was not too helpful for the logout function. &lt;/p&gt;

&lt;p&gt;Hope this helps! &lt;/p&gt;

</description>
      <category>react</category>
      <category>redux</category>
    </item>
    <item>
      <title>Error: Could not find router reducer in state tree, it must be mounted under "router"　</title>
      <dc:creator>Haruka Kato </dc:creator>
      <pubDate>Thu, 21 Jan 2021 01:50:39 +0000</pubDate>
      <link>https://dev.to/harukakato35/error-could-not-find-router-reducer-in-state-tree-it-must-be-mounted-under-router-gca</link>
      <guid>https://dev.to/harukakato35/error-could-not-find-router-reducer-in-state-tree-it-must-be-mounted-under-router-gca</guid>
      <description>&lt;p&gt;&lt;a href="https://gyazo.com/64dd39bc0d236709ea16112c2775b51d"&gt;https://gyazo.com/64dd39bc0d236709ea16112c2775b51d&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hello there! I was trying to introduce google auth to my react-redux app for over a week and I was finally able to solve the problem.&lt;br&gt;
First, I encountered this problem and I read almost all the solutions online but it did not help at all! &lt;/p&gt;

&lt;p&gt;If you look at those solutions, most of them "decrease the version of history", but if it did not work, maybe you wanna take a look at my article!&lt;/p&gt;

&lt;p&gt;I followed this tutorial &lt;a href="https://github.com/GoZaddy/react-redux-firebase-article/blob/master/src"&gt;https://github.com/GoZaddy/react-redux-firebase-article/blob/master/src&lt;/a&gt; to introduce Google Auth to my application. And its index.js is as follows. &lt;/p&gt;

&lt;p&gt;index.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import firebase from "firebase/app";
import "firebase/auth";
import "firebase/firestore";
import { createStore, compose } from "redux";
import { Provider } from "react-redux";
import { ReactReduxFirebaseProvider } from "react-redux-firebase";
import { createFirestoreInstance } from "redux-firestore";
import { rootReducer } from "./ducks/reducers";
import App from "./App";
import { BrowserRouter } from "react-router-dom";
import * as serviceWorker from "./serviceWorker";

const firebaseConfig = {
  apiKey: "AIzaSyBJTFQkg95Aj-s_NsA77mco8ZVG2siLv4U",
  authDomain: "react-redux-firebase-article.firebaseapp.com",
  databaseURL: "https://react-redux-firebase-article.firebaseio.com",
  projectId: "react-redux-firebase-article",
  storageBucket: "react-redux-firebase-article.appspot.com",
  messagingSenderId: "781345165856",
  appId: "1:781345165856:web:45fd42a60e5bb365172245",
  measurementId: "G-XFR3YXLCGW",
};

const rrfConfig = {
  userProfile: "users",
  useFirestoreForProfile: true,
};

firebase.initializeApp(firebaseConfig);
firebase.firestore();

const initialState = {};
const store = createStore(rootReducer, initialState);

const rrfProps = {
  firebase,
  config: rrfConfig,
  dispatch: store.dispatch,
  createFirestoreInstance,
};
ReactDOM.render(
  &amp;lt;React.StrictMode&amp;gt;
    &amp;lt;Provider store={store}&amp;gt;
      &amp;lt;ReactReduxFirebaseProvider {...rrfProps}&amp;gt;
        &amp;lt;BrowserRouter&amp;gt;
          &amp;lt;App /&amp;gt;
        &amp;lt;/BrowserRouter&amp;gt;
      &amp;lt;/ReactReduxFirebaseProvider&amp;gt;
    &amp;lt;/Provider&amp;gt;
  &amp;lt;/React.StrictMode&amp;gt;,
  document.getElementById("root")
);

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I tried every solution online about this error so I thought&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: Could not find router reducer in state tree, it must be mounted under "router"　
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I thought this error was occurring because of my Ducks pattern. So I tried to convert this index.js file to Ducks pattern then I was even more stuck and I didn't know what to do. &lt;/p&gt;

&lt;p&gt;I spent a lot of time looking for how I can convert this Google Auth index.js file to Ducks pattern but I found zero articles. I followed some articles that explain how to convert from Re-ducks pattern to Ducks pattern and I followed but I started to get different errors continuously. &lt;/p&gt;

&lt;p&gt;So I hired a tutor and asked a question and I was finally able to solve this problem. &lt;/p&gt;

&lt;p&gt;Here is the important point. If you follow Ducks pattern, you don't wanna convert Google Auth index.js file to Ducks pattern because it makes things very complicated. &lt;/p&gt;

&lt;p&gt;If you find this error while you are working on react-redux-firebase&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Error: Could not find router reducer in state tree, it must be mounted under "router"　&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;you should look at this official document. &lt;br&gt;
&lt;a href="https://www.npmjs.com/package/connected-react-router"&gt;https://www.npmjs.com/package/connected-react-router&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For me, my problem was I did not have&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;lt;Provider store={store}&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;in my App.js file. &lt;/p&gt;

&lt;p&gt;Here is my App.js file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { Suspense } from 'react';
import { BrowserRouter as Router,Switch, Route} from 'react-router-dom';
import Top from './components/Top';
import Contact from './components/Contact';
import SignUp from './components/SignUp';
import SignIn from './components/SignIn';
import SignOut from './components/SignOut';
import { ConnectedRouter } from 'connected-react-router';
import {history} from './configureStore';
import { Provider } from 'react-redux'
import {configureStore} from './configureStore';
const store = configureStore();

const App = () =&amp;gt; {


    return (
        &amp;lt;React.Fragment&amp;gt;
            &amp;lt;Provider store={store}&amp;gt;
                &amp;lt;ConnectedRouter history={history}&amp;gt;
                            &amp;lt;Switch&amp;gt;
                                &amp;lt;Route exact path="/" component={Top}/&amp;gt;
                            &amp;lt;/Switch&amp;gt;
                            &amp;lt;Switch&amp;gt;
                                &amp;lt;Route exact path="/contact" component={Contact}/&amp;gt;
                            &amp;lt;/Switch&amp;gt;
                            &amp;lt;Switch&amp;gt;
                                &amp;lt;Route exact path="/signup" component={SignUp}/&amp;gt;
                            &amp;lt;/Switch&amp;gt;
                            &amp;lt;Switch&amp;gt;
                                &amp;lt;Route exact path="/signin" component={SignIn}/&amp;gt;
                            &amp;lt;/Switch&amp;gt;
                            &amp;lt;Switch&amp;gt;
                                &amp;lt;Route exact path="/signout" component={SignOut}/&amp;gt;
                            &amp;lt;/Switch&amp;gt;
                            &amp;lt;Switch&amp;gt;
                                &amp;lt;Route exact path="/top" component={Top}/&amp;gt;
                            &amp;lt;/Switch&amp;gt;
                &amp;lt;/ConnectedRouter&amp;gt;
                &amp;lt;/Provider&amp;gt;
        &amp;lt;/React.Fragment&amp;gt;
    )

}
export default App;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;index.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import ReactDOM from 'react-dom';
import App from './App'
import { Provider } from 'react-redux';
import {configureStore} from './configureStore';
import firebase from "firebase/app";
import "firebase/auth";
import "firebase/firestore";
import { useHistory } from "react-router-dom";
import { createFirestoreInstance } from "redux-firestore";
import { BrowserRouter } from "react-router-dom";
import { useDispatch, useSelector } from 'react-redux';
import { ReactReduxFirebaseProvider } from "react-redux-firebase";
import { createStore, compose } from "redux";
import { rootReducer } from "./rootReducer";

  const firebaseConfig = {
    apiKey: "AIzaSyAOSBfTj_VQ4byWAAOWDhAsklmZtk2W_iE",
    authDomain: "stresstackle-599d9.firebaseapp.com",
    projectId: "stresstackle-599d9",
    storageBucket: "stresstackle-599d9.appspot.com",
    messagingSenderId: "930013144401",
    appId: "1:930013144401:web:79b25db79f4118359fdf70",
    measurementId: "G-J26Y6MYWV3"
  };

const rrfConfig = {
  userProfile: "users",
  useFirestoreForProfile: true,
};

firebase.initializeApp(firebaseConfig);
firebase.firestore();

const initialState = {};
const store = createStore(rootReducer, initialState);

const rrfProps = {
  firebase,
  config: rrfConfig,
  dispatch: store.dispatch,
  createFirestoreInstance,
};

ReactDOM.render(
  &amp;lt;React.StrictMode&amp;gt;
    &amp;lt;Provider store={store}&amp;gt;
      &amp;lt;ReactReduxFirebaseProvider {...rrfProps}&amp;gt;

          &amp;lt;App /&amp;gt;

      &amp;lt;/ReactReduxFirebaseProvider&amp;gt;
    &amp;lt;/Provider&amp;gt;
  &amp;lt;/React.StrictMode&amp;gt;,
    document.getElementById('root')
    );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;/src/configureStore.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createStore, applyMiddleware, compose } from 'redux';
import { routerMiddleware } from 'connected-react-router';
import {rootReducer} from './rootReducer';
// import thunk from 'redux-thunk';
// import logger from 'redux-logger';


const createBrowserHistory = require('history').createBrowserHistory;




export const history = createBrowserHistory();
//これをApp.jsに渡した


const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
export  function configureStore(preloadedState) {

    const store = createStore(
        rootReducer(history),
        preloadedState,
        composeEnhancers(
            applyMiddleware(
                routerMiddleware( history),
            )
        )
    );

    return store;
};
//↑Redux dev toolsとconnectingしている


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;/src/rootReducer.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {combineReducers} from 'redux';
import { connectRouter } from 'connected-react-router';
import {firebaseReducer} from "react-redux-firebase";
import {firestoreReducer} from "redux-firestore";

export const rootReducer =(history) =&amp;gt; combineReducers({

    router: connectRouter(history),
    firebase: firebaseReducer,
    firestore: firestoreReducer,
});

//history:履歴管理に必要なもの
//connected-react-router:reduxとつなげられる
//..&amp;gt;..&amp;gt;..&amp;gt;みたいなアプリ上での遷移に対応できる

// title: Consultation,
// inquiry: Consultation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;/src/components/SignIn.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react';
import { useFirebaseApp } from 'reactfire';
import 'firebase/auth'
import { makeStyles } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
import Grid from '@material-ui/core/Grid';
import Header from './BasicComponents/Header';
import Footer from './BasicComponents/Footer';
import Button from '@material-ui/core/Button';
import TextField from '@material-ui/core/TextField';
import { StylesProvider } from "@material-ui/core/styles";
import styled from "styled-components";
import { useFirebase } from "react-redux-firebase";
import { useHistory } from "react-router-dom";
import { useDispatch, useSelector } from 'react-redux';
import { push } from 'connected-react-router'

const useStyles = makeStyles((theme) =&amp;gt; ({
    root: {
        flexGrow: 1,
    },
    paper: {
        textAlign: 'center',
        backgroundColor: '#C0C0C0',
        opacity: 0.7,
        borderRadius: 50,
        height: 500,
        paddingTop: 20,
    },
    grid: {
        position: 'block',
        margin: '0 auto',
        marginTop: 50,
        marginBottom: 50,
    },
    input:{
        width: '70%',
        height: 50,
        fontSize: 15,
        padding: '.3em',
        borderRadius: 10,
        border: '1px solid #aaa',
    },
    input1:{
        width: '70%',
        height: 50,
        fontSize: 15,
        padding: '.1em',
        marginRight: 5,
        borderRadius: 10,
        border: '1px solid #aaa',
    },
    p1:{
        textAlign: 'left',
        paddingLeft: 80,
        fontColor: 'black',
    },
    button1:{
        backgroundColor: 'pink',
        color: 'black',
        width: '35%',
        borderRadius:40,
        marginTop: 10,
    },
    button2:{
        backgroundColor: '#9400D3',
        color: 'black',
        width: '35%',
        borderRadius:40,
    },
}));


export default function SignUp() {
    const classes = useStyles();
    const auth = useSelector(state =&amp;gt; state.auth); //global stateを呼び出すため,Dev toolをみて決めてる
    const dispatch = useDispatch();
    const firebase = useFirebase();

    const signInWithGoogle = () =&amp;gt; {
        firebase
            .login({
                provider: "google",
                type: "popup",
            })
            .then(() =&amp;gt; {
                dispatch({ type: "USE_PROFILE" });
                dispatch(push('/top'));
            });
    };


    return (
            &amp;lt;div className={classes.root}&amp;gt;
                &amp;lt;Header/&amp;gt;
                &amp;lt;Grid &amp;gt;
                    &amp;lt;Grid item xs={5} className={classes.grid}&amp;gt;
                        &amp;lt;Paper className={classes.paper}&amp;gt;
                            &amp;lt;form&amp;gt;
                            &amp;lt;h1&amp;gt;Welcome back!&amp;lt;/h1&amp;gt;
                              &amp;lt;p&amp;gt;Please sign in below to continue&amp;lt;/p&amp;gt;
                                 &amp;lt;p className={classes.p1}&amp;gt;Email address&amp;lt;/p&amp;gt;
                                    &amp;lt;input
                                        type="text"
                                        name="Email"
                                        className={classes.input1}
                                    /&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;
                                    &amp;lt;p className={classes.p1}&amp;gt;Password&amp;lt;/p&amp;gt;
                                    &amp;lt;input
                                        type="password"
                                        name="password"
                                        className={classes.input}
                                    /&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;
                                        &amp;lt;Button classes={{root: classes.button1,}} type="submit"&amp;gt;
                                            Sign in
                                        &amp;lt;/Button&amp;gt;
                                            &amp;lt;p&amp;gt;or&amp;lt;/p&amp;gt;
                                        &amp;lt;Button classes={{root: classes.button2,}}
                                                onClick={(event) =&amp;gt; {
                                                    event.preventDefault();
                                                    signInWithGoogle();
                                                }} &amp;gt;
                                            Sign in with Gmail
                                        &amp;lt;/Button&amp;gt;&amp;lt;br&amp;gt;&amp;lt;/br&amp;gt;
                            &amp;lt;p &amp;gt;Forgot Password?&amp;lt;/p&amp;gt;
                            &amp;lt;/form&amp;gt;
                        &amp;lt;/Paper&amp;gt;
                    &amp;lt;/Grid&amp;gt;
                &amp;lt;/Grid&amp;gt;
            &amp;lt;Footer/&amp;gt;
        &amp;lt;/div&amp;gt;

    );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I think this article can be helpful if you are working on react-redux-firebase and find this error because there are not many articles that explain how to solve this error for a react-redux-firebase app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: Could not find router reducer in state tree, it must be mounted under "router"　
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hope this was helpful for you! &lt;/p&gt;

</description>
      <category>react</category>
      <category>redux</category>
    </item>
    <item>
      <title>How to override Material UI button styles </title>
      <dc:creator>Haruka Kato </dc:creator>
      <pubDate>Sun, 10 Jan 2021 07:22:53 +0000</pubDate>
      <link>https://dev.to/harukakato35/how-to-override-material-ui-button-styles-14oa</link>
      <guid>https://dev.to/harukakato35/how-to-override-material-ui-button-styles-14oa</guid>
      <description>&lt;p&gt;I was trying to change&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;border-radius: 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for my button and I somehow could not change. I found out that Material UI button has default styles and you have to override it in order to change things. So when you change some styles and they are not applied, you should 'inspect' and check if the styles are crossed. Then that means the default styles won over your styles! &lt;/p&gt;

&lt;p&gt;I looked at many articled and this worked. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://material-ui.com/customization/components/"&gt;https://material-ui.com/customization/components/&lt;/a&gt; Please look at this document too! &lt;/p&gt;

&lt;p&gt;This document says 'When the className property isn't enough, and you need to access deeper elements, you can take advantage of the classes object property to customize all the CSS injected by Material-UI for a given component'.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; &amp;lt;Button classes={{root: classes.button1,}}&amp;gt;
     Confirm
 &amp;lt;/Button&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Some articles were suggesting&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { StylesProvider } from "@material-ui/core/styles";

const StyledButton = styled(Button)`
  background-color: red;
  border-radius: 0;
`;

export default function App() {
  return (
    &amp;lt;StylesProvider injectFirst&amp;gt;
      &amp;lt;div className="App"&amp;gt;
        &amp;lt;StyledButton&amp;gt;Hello&amp;lt;/StyledButton&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/StylesProvider&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But this did not work for me. Since the way I followed is from Material UI official document, I guess it is more reliable. &lt;/p&gt;

&lt;p&gt;Give me suggestions or comments if you know better ways or something! Hope this helps :) &lt;/p&gt;

</description>
      <category>react</category>
    </item>
    <item>
      <title>text-align:center doesn't work for button</title>
      <dc:creator>Haruka Kato </dc:creator>
      <pubDate>Fri, 08 Jan 2021 00:54:11 +0000</pubDate>
      <link>https://dev.to/harukakato35/text-align-center-doesn-t-work-for-button-5g1c</link>
      <guid>https://dev.to/harukakato35/text-align-center-doesn-t-work-for-button-5g1c</guid>
      <description>&lt;p&gt;I was trying to place a button in the center and I could not apply text-align:center or margin: 0 auto and I found out that&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;button:{
  textAlign: 'center',
},

 &amp;lt;div className={classes.button}&amp;gt;
     &amp;lt;Button variant="contained" color="primary"　　　
　　　　disableElevation　className={classes.button}&amp;gt;
       Confirm
     &amp;lt;/Button&amp;gt;
 &amp;lt;/div&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can enclose Button tag with div and apply text-align:center to div element! &lt;/p&gt;

&lt;p&gt;Hope this helps! &lt;/p&gt;

</description>
      <category>react</category>
      <category>css</category>
    </item>
    <item>
      <title>text-align: center does not work... </title>
      <dc:creator>Haruka Kato </dc:creator>
      <pubDate>Fri, 08 Jan 2021 00:45:31 +0000</pubDate>
      <link>https://dev.to/harukakato35/text-align-center-does-not-work-24ci</link>
      <guid>https://dev.to/harukakato35/text-align-center-does-not-work-24ci</guid>
      <description>&lt;p&gt;I wanted those two boxes to be in the center but I couldn't apply 'text-align:center'. &lt;/p&gt;

&lt;p&gt;I was doing some search and I found out for block elements such as&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;p&amp;gt; &amp;lt;div&amp;gt; &amp;lt;h1&amp;gt;〜&amp;lt;h6&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
 the default is 'display:block' so you can't place the element itself in the center (text and image in the element will be centered). &lt;/p&gt;

&lt;p&gt;So here is what you wanna do.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;margin: 10px auto;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means margin-right equals margin-left so it can place the element in the center! &lt;/p&gt;

&lt;p&gt;CSS can be tricky and I sometimes spend a lot of time trying to figure it out but I hope I will get used to more rules.&lt;/p&gt;

&lt;p&gt;Hope this can be helpful for you!&lt;/p&gt;

</description>
      <category>css</category>
      <category>react</category>
    </item>
    <item>
      <title>How to set background image in React</title>
      <dc:creator>Haruka Kato </dc:creator>
      <pubDate>Tue, 05 Jan 2021 10:25:41 +0000</pubDate>
      <link>https://dev.to/harukakato35/how-to-set-background-image-in-react-20gd</link>
      <guid>https://dev.to/harukakato35/how-to-set-background-image-in-react-20gd</guid>
      <description>&lt;p&gt;Having trouble setting a background image in your react project? I was looking at many posts on websites and I was finally able to solve this problem.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import candles from './Picture/candles.jpg';

&amp;lt;Box
    class="candles"
    style={{
    backgroundImage: `url(${candles})`,
}}&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I was trying this way for a while and it looked nothing wrong with it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import candles from './Picture/candles.jpg';

&amp;lt;Box
    class="candles"
    style={{
    backgroundImage: `url(${candles})`,
    backgroundSize: "cover",
    height: "100vh",
    color: "#f5f5f5"
}}&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This worked and I found out that the image I was using was bigger than div default so it needed to be specified its height. So if you are struggling to set your background image in react, you can try this!&lt;/p&gt;

&lt;p&gt;Hope this is helpful for you :)&lt;/p&gt;

</description>
      <category>react</category>
      <category>css</category>
    </item>
    <item>
      <title>text-align: right doesn't work...</title>
      <dc:creator>Haruka Kato </dc:creator>
      <pubDate>Sat, 26 Dec 2020 10:20:17 +0000</pubDate>
      <link>https://dev.to/harukakato35/text-align-right-doesn-t-work-2ekl</link>
      <guid>https://dev.to/harukakato35/text-align-right-doesn-t-work-2ekl</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--W2yiDnMy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/by6rpe8ifc8chdm5gu08.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W2yiDnMy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/by6rpe8ifc8chdm5gu08.png" alt="Screen Shot 2020-12-26 at 19.22.26"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I trapped in this problem many times so I would like to leave it here. &lt;/p&gt;

&lt;p&gt;I wanted this 'Login' button to be on the right edge of this header but I could not apply text-align: right.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';
import IconButton from '@material-ui/core/IconButton';
import MenuIcon from '@material-ui/icons/Menu';

const useStyles = makeStyles((theme) =&amp;gt; ({
  root: {
    flexGrow: 1,
  },
button:{
    textAlign: 'right',
    display:'block',
}
}));

export default function Top() {
  const classes = useStyles();

  return (
      &amp;lt;div className={classes.root}&amp;gt;
        &amp;lt;AppBar position="static" color='white'&amp;gt;
          &amp;lt;Toolbar &amp;gt;
            &amp;lt;Button className={classes.button} 
                    color="inherit"&amp;gt;Login
            &amp;lt;/Button&amp;gt;
          &amp;lt;/Toolbar&amp;gt;
        &amp;lt;/AppBar&amp;gt;
      &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I found out this does not work because Button is enclosed by the parent element, 'Toolbar'. When you use 'text-align', it needs to know 'where is the center?' or 'where is the middle?'. Therefore, you should select a parent element which is also a block element, and apply text-align.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';
import IconButton from '@material-ui/core/IconButton';
import MenuIcon from '@material-ui/icons/Menu';

const useStyles = makeStyles((theme) =&amp;gt; ({
  root: {
    flexGrow: 1,
  },
button:{
    textAlign: 'right',
    display:'block',
}
}));

export default function Top() {
  const classes = useStyles();

  return (
      &amp;lt;div className={classes.root}&amp;gt;
        &amp;lt;AppBar position="static" color='white'&amp;gt;
          &amp;lt;Toolbar className={classes.button}&amp;gt;
            &amp;lt;Button color="inherit"&amp;gt;Login&amp;lt;/Button&amp;gt;
          &amp;lt;/Toolbar&amp;gt;
        &amp;lt;/AppBar&amp;gt;
      &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I used to use 'float: right' but it's not really recommended for various reasons so I've been trying to find other ways! &lt;/p&gt;

&lt;p&gt;Please give me any correction if my grammar is weird or does not make sense! &lt;/p&gt;

</description>
      <category>css</category>
      <category>react</category>
    </item>
    <item>
      <title>Permission to username/project.git denied to user</title>
      <dc:creator>Haruka Kato </dc:creator>
      <pubDate>Thu, 24 Dec 2020 09:39:53 +0000</pubDate>
      <link>https://dev.to/harukakato35/permission-to-username-project-git-denied-to-user-323k</link>
      <guid>https://dev.to/harukakato35/permission-to-username-project-git-denied-to-user-323k</guid>
      <description>&lt;p&gt;I was trying to push my new repository to my Github and the permission was denied because I was trying to push it to my old workplace's account. &lt;/p&gt;

&lt;p&gt;But it took some time to find the right solution for me so I wanted to leave here. &lt;/p&gt;

&lt;p&gt;If you attempt all these steps and your terminal says like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;remote: Permission to harukakato35/StressBox.git denied to ○○○.
fatal: unable to access 'https://github.com/harukakato35/StressBox.git/': The requested URL returned error: 403
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Try this as the quickest way.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push git@github.com:harukakato35/StressBox.git main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or with this way, you can connect with the account you want&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git remote set-url origin https://hoge@github.com/hoge/abc.git
$ git push origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hope this is useful for you!&lt;/p&gt;

</description>
      <category>github</category>
      <category>git</category>
    </item>
  </channel>
</rss>
