クラスコンポーネントで複数の静的ContextTypeを定義するには?クラスコンポーネントで複数の静的ContextTypeを定義するには?
1109 ワード
クラスコンポーネントで複数の静的ContextTypeを定義するには?
9月28日
コメント: 1
回答:0
0
こんにちは私はクラスコンポーネントメソッドで複数のコンテキストを使用する必要があるときにどのように複数の静的contexttypeを定義できるかを知りたいです.export default class Component extends React.Component{
static contextType = MyContext1; //and MyContext2
constructor(props){
super(props);
}
componentDidMount = () => console.log(this.context); //need Context2
render(){
return(
...
Open Full Question
Reference
この問題について(クラスコンポーネントで複数の静的ContextTypeを定義するには?クラスコンポーネントで複数の静的ContextTypeを定義するには?), 我々は、より多くの情報をここで見つけました
https://dev.to/mehrzadtejareh/how-can-i-define-multiple-static-contexttype-in-a-class-component-1lg9
テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol
export default class Component extends React.Component{
static contextType = MyContext1; //and MyContext2
constructor(props){
super(props);
}
componentDidMount = () => console.log(this.context); //need Context2
render(){
return(
Reference
この問題について(クラスコンポーネントで複数の静的ContextTypeを定義するには?クラスコンポーネントで複数の静的ContextTypeを定義するには?), 我々は、より多くの情報をここで見つけました https://dev.to/mehrzadtejareh/how-can-i-define-multiple-static-contexttype-in-a-class-component-1lg9テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol