-1

I'm using TypeScript in my Vite React project. I'm having problems to build my project because of this error, says that the name property doesn't exist. Someone know how I can fix that?

Type '{ children: Element; name: string; className: string; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'.
  Property 'name' does not exist on type 'DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>'.

The code

<div
  name='contact'
  className='w-full h-screen bg-dark text-white flex justify-center items-center p-4'
>
  ...
</div>
RubenSmn
  • 4,091
  • 2
  • 5
  • 24

1 Answers1

1

The property name does not exists on a HTMLDivElement

Instead you can use the Element from react-scroll

import { Element } from "react-scroll";

<Element name="contact" className="w-full">
  Scroll to this element
</Element>;

or if you want to scroll to your own element e.g. div, you can use a id

<div
  id="contact"
  className="w-full h-screen bg-dark text-white flex justify-center items-center p-4"
></div>
RubenSmn
  • 4,091
  • 2
  • 5
  • 24