interact.tsx 645 B

12345678910111213141516171819202122232425
  1. import React, { useCallback, useEffect, useRef } from 'react';
  2. import { useCTA } from '../hooks/cta';
  3. import { Container } from './identify.styles';
  4. export type Props = {
  5. setInteracted: (interacted: boolean) => void;
  6. };
  7. export const Interact: React.FC<Props> = ({ setInteracted }) => {
  8. const onInteract = useCallback(() => setInteracted(true), [setInteracted]);
  9. const ctaProps = useCTA(onInteract);
  10. const button = useRef<HTMLButtonElement>(null);
  11. useEffect(() => {
  12. button.current?.focus();
  13. }, []);
  14. return (
  15. <Container>
  16. <button {...ctaProps} ref={button}>
  17. Continue
  18. </button>
  19. </Container>
  20. );
  21. };