'TypeError: Cannot read properties of undefined (reading 'create') in react error
i practice react but i facing some error I know this small error but I am beginner in react
i trying to authentication firebase but i facing this error
When i sign in button press this type error comming
TypeError: Cannot read properties of undefined (reading 'create')
my app.js code
app.js
function App() {
const [isAuth, setIsAuth] = useState()
return (
<Router>
<nav>
<Link to="/login">login</Link>
<Link to="/post">Create Post</Link>
<Link to="/">home</Link>
</nav>
<Routes>
<Route exact path="/login" element={<Login setIsAuth={setIsAuth}/>} />
<Route exact path="/" element={<Home />} />
<Route exact path="/post" element={<CreatPost />} />
</Routes>
</Router>
);
}
export default App;
my login.js code
login.js
function Login({ setIsAuth }) {
const singInGoogle = () => {
signInWithPopup(provider, auth).then((result) => {
setIsAuth(true);
localStorage.setItem("isAuth", true);
});
};
return (
<div>
<p>sign In with to google acount</p>
<button onClick={singInGoogle}>sign In</button>
</div>
);
}
export default Login;
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

