Replies: 1 comment 1 reply
-
Default props provide the functionality to define DEFAULT value for the specific prop. Default values can if so desired be changed by higher order component. If you want uncheangable prop why are you defining those as props? Prop is like function or method parameter to a component
Are you providing list of child components to that ListView component where you are iterating through them? If that is the case you could maybe have that information stored elsewhere which components can be focused? Or you can use the prop and read it there, but it cannot be made readonly. |
Beta Was this translation helpful? Give feedback.
-
Hello. I have some components which must have default props on creation and these default props must be unchangeable by other components and the component itself. How can I accomplish this with typescript?
I have a Separator component and a ListView component. The ListView components makes
isFocused
prop of its childrentrue
whenever the cursor is on them. But regarding Separator, this must never happen that this component can never get focused. So I want this component have a default readonly propunFocusable
set totrue
to tell ListView that it never must get focus.Beta Was this translation helpful? Give feedback.
All reactions