import React from "react";
import _ from "lodash";
import styled from "styled-components";
const StyledContainer = styled.div`
text-align: center;
width: 100%;
font-size: 2rem;
color: lightgrey;
`;
const EmptyState = ({ input, children }) => {
const isEmpty = _.isEmpty(input);
return isEmpty ? <StyledContainer>Empty</StyledContainer> : children;
};
export default EmptyState;
import React from "react";
import EmptyState from "./EmptyState";
const App = ({ data }) => {
return (
<EmptyState input={data}>
{data.map((name) => (
<h3>{name}</h3>
))}
</EmptyState>
);
};
export default App;