๐งพ Bootstrap / HTML โ Next.js (React JSX) Differences
๐ 1๏ธโฃ class โ className
HTML / Bootstrap
Next.js / React
๐ Reason: class JS ka reserved word hai
๐ 2๏ธโฃ for โ htmlFor
๐ 3๏ธโฃ onclick โ onClick
โ () nahi lagate (auto run ho jayega)
๐ 4๏ธโฃ Inline CSS string โ Object
๐ camelCase + double {}
๐ 5๏ธโฃ style value โ camelCase
๐ 6๏ธโฃ checked, selected โ boolean
๐ 7๏ธโฃ value โ state controlled
๐ 8๏ธโฃ href โ Link
๐ Fast navigation, no reload
๐ 9๏ธโฃ img โ Image (recommended)
๐ ๐ JS directly โ useEffect
๐ 1๏ธโฃ1๏ธโฃ document / window direct โ
โ Correct:
๐ 1๏ธโฃ2๏ธโฃ if else HTML โ โ JSX ternary
๐ 1๏ธโฃ3๏ธโฃ Loop (for) โ map()
๐ 1๏ธโฃ4๏ธโฃ data-* attributes (same)
โ Bootstrap data attributes same hi rehte hain
๐ 1๏ธโฃ5๏ธโฃ Self closing tags
๐ 1๏ธโฃ6๏ธโฃ readonly โ readOnly
๐ 1๏ธโฃ7๏ธโฃ tabindex โ tabIndex
๐ 1๏ธโฃ8๏ธโฃ Comments
๐ 1๏ธโฃ9๏ธโฃ dangerouslySetInnerHTML
โ ๏ธ XSS risk
๐ 2๏ธโฃ0๏ธโฃ Bootstrap icons / JS plugins
-
CSS โ normal import
-
JS โ
useEffectonly
๐ง One-look Cheatsheet (exam style)
| HTML | Next.js |
|---|---|
| class | className |
| for | htmlFor |
| onclick | onClick |
| style=โโ | style={{}} |
| a href | Link |
| img | Image |
| script | useEffect |
| document | useRef |
๐ง Golden line (notes me likh lo)
โHTML jaisa dikhta hai, par JSX JavaScript haiโ
