import React from 'react';

interface Props {
  x: number;
  y: number;
  alive?: boolean;
  toggle: (x: number, y: number) => void;
}

const Cell = (props: Props) => {
  const { alive, toggle, x, y } = props;
  return (
    <span
      onClick={() => toggle(x, y)}
      className={`cell ${alive ? 'alive' : 'dead'}`}
    ></span>
  );
};

export default Cell;
