I am trying to get intellisense in VSCode working for functional components that use forwardRef
.
Assume a functional component like this:
const Slider = forwardRef(({value = 0, onChange = () => { /* some function */ }}, ref) => {
return "whatever"
})
export default Slider;
If use this component somewhere else, the props value
and onChange
are not suggested by intellisense. I am not using typescript, so is there any workaround to get intellisense work in this case without adding much overhead?
I just found suggestions for typescript implementations, but not for this approach.
2
Answers
The only thing you can do in this situation is to use JSDoc comments in order to help VSCode to be able to make suggestions. Something like this
You can use JSDoc comment: