Skip to content
Advertisement

How to add tabIndex = ‘0’ in TypeScript div?

I am using Typescript with NextJS, i want to add tabIndex = '0' in one of the div. but am getting this error Type 'string' is not assignable to type 'number'… how to achive this?

‹div className= 'container' tabIndex = '0'>

Advertisement

Answer

Instead of tabIndex='0' , you should write it as tabIndex={0}. This way Ty[escript will understand. <div className="container tabIndex={0}>

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement