Skip to content

Commit

Permalink
agregue el Hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Luis-Kristen committed Mar 26, 2020
1 parent 0785cc4 commit 370d2f9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/hooks/useInitialState.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { useState, useEffect } from 'react';

const useInitialState = (API) => {
const [ videos , setVideos ] = useState([]);
useEffect(() => {
fetch(API)
.then( (response) => response.json())
.then((data) => setVideos(data));
}, []);
return videos;
};

export default useInitialState;

0 comments on commit 370d2f9

Please sign in to comment.