Relative Content

Tag Archive for reactjstypescript

DropDown with submenu

I’m trying to create a dropdown for users, similar to the one on YouTube, where there is a main menu and submenus. I define it like this:

Generate object access keys from props

I have problems with dynamisation in Typescript. I know that TS works statically. However, there are sometimes situations where I want to access an object dynamically and cannot do this directly via any generics because the values are generated. Perhaps you could help me to understand the whole thing a little better. I have the following example:

(React + TS) I get a ts error when I try to access .current saying current doesn’t exist but in fact it does and I can access it,

I’m trying to get rid of the error occurring when im accessing .current from mainContainer passed from the App component, the error says “Property ‘current’ does not exist on type ‘((instance: unknown) => void) | MutableRefObject’.
Property ‘current’ does not exist on type ‘(instance: unknown) => void’.ts(2339)
any”, but it actually exists and I can access it.