Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Text
Posted by: Ce Guan
Added: Dec 30, 2019 12:19 AM
Views: 9
Tags: no tags
  1. import Types from 'MyTypes';
  2. import React from 'react';
  3. import {connect} from 'react-redux';
  4.  
  5. import Button from '@material-ui/core/Button';
  6.  
  7. import {uiStateActions} from '../../features/ui-state'
  8. import {authActions} from "../../features/auth";
  9.  
  10. type AuthModalState = {
  11.     authModalMode: number
  12.     email: string
  13.     password: string
  14. }
  15.  
  16. type AuthModalProps = {
  17.     authModalOpened: boolean
  18.     toggleAuthModal: Function
  19.     register: Function
  20. }
  21.  
  22. class UserProfile extends React.Component<AuthModalProps, AuthModalState> {
  23.     constructor(props: AuthModalProps) {
  24.         super(props)
  25.     }
  26.  
  27.     render() {
  28.         return (
  29.             <Button>hello</Button>
  30.         )
  31.     }
  32. }
  33.  
  34. function mapStateToProps(state: Types.RootState) {
  35.     return {
  36.         authModalOpened: state.uiState.authModal.visible,
  37.     }
  38. }
  39.  
  40. const dispatchProps = {
  41.     toggleAuthModal: uiStateActions.toggleAuthModalAction,
  42.     register: authActions.registerAction,
  43. };
  44.  
  45. // @ts-ignore
  46. export default connect(mapStateToProps, dispatchProps)(UserProfile)
  47.