Phrasely it's a Open Source educational english games creator made by
@eehcx,@mAbimael700and@Peter2k3students of Polytechnic University of the Center.
At this moment are avialable hooks for registered questions, teachers, and guest: useQuestion and useUser
import { useUser } from '../hooks/useUser';
const AddTeacher: React.FC = () => {
const { registerNewTeacher } = useUser();
const handleRegisterTeacher = () => {
registerNewTeacher({ id: '1', displayName: 'John Doe', email: 'john.doe@example.com' });
};
return <button onClick={handleRegisterTeacher}>Register Teacher</button>;
};If you want to show the information saved in the local storage, you ony need to call the useAppSelector hook in your component.
import { useAppSelector } from '../redux/reduxHooks';
const TeacherInfo: React.FC = () => {
const teacher = useAppSelector((state) => state.user.teacher);
if (!teacher) {
return <p>No teacher registered</p>;
}
return (
<>
<p>{teacher.displayName}</p>
<p>{teacher.email}</p>
</>
);
};In the same way your should to query all the
slicesin the app.
You only import the useAppSelector from /redux/reduxHooks.ts directory
import { useAppSelector } from '../redux/reduxHooks';- slice: represent any slice in redux like
questionoruserslices. - interface: represent an interface assigned for the slice like
teacher,guests,questionsorcurrent.
const interface = useAppSelector((state) => state.slice.interface);You only need to call the const where do you keep the information of the AppSelector.
const ShowInfo: React.FC = () => {
return (
<>
<p>{interface.content}</p>
</>
);
};For more information about the content of the slices query ./src/types/
Para más detalles, sobre la configuración de vite Consulta aquí.
