React Component Setup
1. Set up types file for react component props and state
import { Dispatch } from 'react-redux';
import { User } from './User.d';
import { register_fntype } from '../actions/userActions';
export interface Action {
type: string;
}
export interface UserAction extends Action {
data?: User;
error?: string;
}
export type Users = Array<User>;
export type UserState = User | {};
// defines types of everything in Redux Store
export interface Store {
user: User;
}
// defines Prop types passed to the Register React component
// this would define any redux actions and state passed into the component
// essentially, anything in mapStateToProps and mapDispatchToProps would be
// defined here
export interface RegisterProps {
register: register_fntype;
completeRegistration: any;
}
2. Set Up React Component
Last updated