Skip to content

Instantly share code, notes, and snippets.

View AlexCharlton93's full-sized avatar

Alex Charlton AlexCharlton93

  • Crewe
View GitHub Profile
@AlexCharlton93
AlexCharlton93 / react
Created February 21, 2021 17:43
API Call
const MyComponent = ({ fetchData }) => {
const [data, setData] = useState(null);
const [dataError, setDataError] = useState(null);
useEffect(() => {
fetchData()
.then(setData)
.catch(setDataError);
}, []);
@AlexCharlton93
AlexCharlton93 / react
Last active March 21, 2022 17:05
Functional Component
import React from 'react';
export const FunctionalComponent = ({ propOne, propTwo }) => {
return (
<>
{propOne}
{propTwo}
</>
);
};