Created
March 21, 2020 22:38
-
-
Save jasonleehodges/69f8737a862eeb9c3ac7288b033c0e57 to your computer and use it in GitHub Desktop.
Using Data Service Custom Hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { FC } from 'react'; | |
import { useDataSErvice } from '../hooks'; | |
import { useSelector } from 'react-redux'; | |
import { selectData } from '../selectors'; | |
export const ExampleComponent: FC = (props) => { | |
const { getData } = useDataService(); | |
const data = useSelector(selectData); | |
useEffect(() => { | |
getData(); | |
}, []); | |
return ( | |
<div>{ data }</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment