Tag: TypeScript
-
React TS createContext()
Using context in your react app is really useful, when you are passing some prop to multiple nested elements for example Theme How to use it? In this example we will make Theme provider. Create ThemeProvider.tsx It will hold our wrapper that implements the theme for all child components. Then make Class or functional component…
-
React TS useRef() hook
This hook is useful when we are trying to read some input field or when we just need the reference to the element for getting size or other properties. How to use it? imagine we are trying to make a tooltip under some element when user hovers over it and now we can use it…