From 11f261306e425e7339c708c018908d414929ebea Mon Sep 17 00:00:00 2001 From: Jitu007-Bunde Date: Tue, 26 May 2020 19:10:10 +0530 Subject: [PATCH] add RecognitionListContainer and add store.dispatch code for saga Api call --- .../RecognitionListContainer.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 react-frontend/src/recognition-list/RecognitionListContainer.js diff --git a/react-frontend/src/recognition-list/RecognitionListContainer.js b/react-frontend/src/recognition-list/RecognitionListContainer.js new file mode 100644 index 000000000..a83a6f36f --- /dev/null +++ b/react-frontend/src/recognition-list/RecognitionListContainer.js @@ -0,0 +1,26 @@ +import React, { useEffect, useState } from "react"; +import { useSelector } from "react-redux"; + +import { store } from "root/redux-store"; + +const RecognnitionListContainer = () => { + const recognitionList = useSelector((state) => state.recognitionReducer); + const [ListStatus, setListStatus] = useState(false); + + useEffect(() => { + if (!ListStatus) { + store.dispatch({ type: "RECOGNITION_GET_API", payload: {} }); + setListStatus(true); + } + }, [ListStatus]); + + return ( +
+ {recognitionList.map((el, key) => ( +

{el.id}

+ ))} +
+ ); +}; + +export default RecognnitionListContainer;