File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
import {createContext, useContext, useState} from 'react';
import PropTypes from 'prop-types';
const UserContext = createContext();
export const UserProvider = ({children}) => {
const [user, setUser] = useState(null);
return (
<UserContext.Provider value={{user, setUser}}>
{children}
</UserContext.Provider>
);
};
UserProvider.propTypes = {
children: PropTypes.node,
};
export const useUserContext = () => useContext(UserContext);
export default UserContext;