import { Button, Card, FormGroup, H2, InputGroup } from "@blueprintjs/core"; import * as React from "react"; import { connect } from "react-redux"; import { Dispatch } from "redux"; import { IAppState } from "../redux/reducers"; import { userPassChange } from "../redux/user/actions"; export interface IAccountComponentProps { username: string | undefined; changePass: (password: string) => void; } export function AccountComponent(props: IAccountComponentProps) { const [pass, setPass] = React.useState(""); return (
) => { e.preventDefault(); if (pass.trim()) { props.changePass(pass); } }} >

Account

) => setPass(e.currentTarget.value) } />
); } function mapStateToProps(state: IAppState) { return { username: state?.user?.user?.username }; } function mapDispatchToProps(dispatch: Dispatch) { return { changePass: (password: string) => dispatch(userPassChange(password)), }; } export const Account = connect( mapStateToProps, mapDispatchToProps, )(AccountComponent);