typescript-cheatsheets / react

Cheatsheets for experienced React developers getting started with TypeScript

Home Page:https://react-typescript-cheatsheet.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Class Properties example do not work correctly (Class components section)

Armas0n opened this issue · comments

Hi there!
Preamble to class properties code example said:

If you need to declare class properties for later use, just declare it like state, but without assignment.

Seems like it is not the case nowadays. TS raise an error TS2564: Property 'pointer' has no initializer and is not definitely assigned in the constructor.

TS Playground

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions!

sorry i didnt get round to addressing this yet, let me know if you have a better suggestion and PR it in!