How to declare "propTypes" for React Hooks using React.useContext

Viewed 2086

Given an app environment where typescript is not an option und React Hooks are used.

When using a context with ...

const myContext = useContext(MyContext)

...how would one declare the context signature in a way we know it from the propTypes-concept?

Would React use such a declaration for warnings?

I try to assure a warning is shown for my component if the context signature changes one day.

0 Answers
Related