From b1f05fa57c862ce8219e5ca464e794353261f842 Mon Sep 17 00:00:00 2001 From: ks129 <45097959+ks129@users.noreply.github.com> Date: Sun, 21 Feb 2021 07:35:29 +0200 Subject: Migrate from public state map to Redux --- src/components/InputTypes/Checkbox.tsx | 7 +- src/components/InputTypes/Select.tsx | 40 +++++++-- src/components/InputTypes/index.tsx | 13 +-- src/components/Question.tsx | 153 ++++++++++++++++++++------------- 4 files changed, 137 insertions(+), 76 deletions(-) (limited to 'src/components') diff --git a/src/components/InputTypes/Checkbox.tsx b/src/components/InputTypes/Checkbox.tsx index 3093caf..b3130c6 100644 --- a/src/components/InputTypes/Checkbox.tsx +++ b/src/components/InputTypes/Checkbox.tsx @@ -3,6 +3,8 @@ import { jsx, css } from "@emotion/react"; import React, { ChangeEvent } from "react"; import colors from "../../colors"; import { multiSelectInput, hiddenInput } from "../../commonStyles"; +import {useSelector} from "react-redux"; +import {FormState} from "../../store/form/types"; interface CheckboxProps { index: number, @@ -53,10 +55,13 @@ const activeStyles = css` `; export default function Checkbox(props: CheckboxProps): JSX.Element { + const values = useSelector( + state => state.values + ); return (