본문 바로가기

A.개발관련자료

[0]Uncaught (in promise) TypeError: Cannot read properties of null (reading 'clientWidth') - react tailwindcss error

1. 해당 width를 적용하는 부분(ex: 데이터를 불러오는 부분, 클릭시 이벤트)에서 width와 관련된 태그내부 길이를 document.getById("").clientHeight로 동적 길이를 측정 후 => useState로 이벤트 실행시 길이 변경

2.tailwind에서 이벤트 발생시 변동되는 값의 경우 적용이 되지 않는 경우가 있다.

tailwind css는  정적으로 알려진 클래스에 의존하기 때문에 작동하지 않을수 있다. 따라서 이럴 경우에는 style컴퍼넌트를 사용한다.

참고:  https://stackoverflow.com/questions/73199212/change-class-attribute-dynamically-inline-with-tailwind