A React Context for the Instructor Profile to be used in the user's profile page
Requires
- module:React.createContext
- module:React.useContext
- module:React.useReducer
Methods
# inner contextReducer(state, action) → {InstructorProfile|Error}
A React Context Reducer function that manages the state of the Instructor Profile Context. This function processes the action type that is given and handles the dispatching of new state values based on the action type.
Parameters:
Name | Type | Description |
---|---|---|
state |
InstructorProfile
|
The current state of the context |
action |
Object
|
The action object |
type |
string
|
The type of action to be performed |
payload |
string
|
The payload of the action |
The new state of the context or an error if the action type is not found.
InstructorProfile
|
Error
# inner InstructorProvider(children) → {JSX.Element}
A React Context Provider wrapper component that uses useReducer
to manage the state of the Instructor Profile Context
Parameters:
Name | Type | Description |
---|---|---|
children |
React.ReactChild
|
The children components to be rendered inside of the provider |
The Provider component for the Instructor Profile Context
JSX.Element
# inner useInstructorContext() → {InstructorProfile|Error}
A hook to access the Instructor Profile Context from any component that resides in the Instructor Profile Context Provider
The current state of the context or an error if the context is not found or not within the Provider.
InstructorProfile
|
Error
Type Definitions
Object
# InstructorProfile
The default state of the Instructor Profile Context
Properties:
Name | Type | Description |
---|---|---|
id |
string
|
The id of the instructor |
title |
string
|
The title of the instructor |
officeLocation |
string
|
The office location of the instructor |
officeHours |
string
|
The office hours of the instructor |
contactPolicy |
string
|
The contact policy of the instructor |
phone |
string
|
The phone number of the instructor |
background |
string
|
The background of the instructor |
researchInterest |
string
|
The research interest of the instructor |
selectedPapersAndPublications |
string
|
The selected papers and publications of the instructor |
personalWebsite |
string
|
The personal website URL of the instructor |
philosophy |
string
|
The philosophy of the instructor |