Answer the question
In order to leave comments, you need to log in
How to use the new React Context in stateless components?
Hello.
How can I get the Context'a value in a stateless component?
In the version with the class it works, but not with the function declaration.
export function Test(props, context) {
console.log(` --- `, context); //не работает
return (
<div>Hello</div>
)
}
Test.contextType = OnwContext // статическая переменная как в классом варианте тоже не работает
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question