skip to Main Content

fetch data to Redux state – Reactjs

is it possible to add data to redux state this method: const dispath = useDispatch(); useEffect(() => { fetch(`https://newsapi.org/v2/top-headlines?country=${location.state}&apiKey=${apiKey}`) .then(res => res.json()) .then(data => { setNewsAll(data) console.log(data) setLoadingNews(false) dispath(data.totalResults) // <= this line ! i know that it must be…

VIEW QUESTION

React Native FlatList Data is not Showing Data

I am Using Redux and My Problem is When First Time My Screen Loads I am getting error undefined is not an object(evaluating 'response.data') My Code Is function LaunchScreen(props) { const [response, setData] = useState([]); useEffect(() => { props.getProperties; setData(props.properties);…

VIEW QUESTION
Back To Top
Search