Page 1 of 1

Q22 Which of the following are true w.r.t context API a) Context API is used to share the date between multiple componen

Posted: Fri May 20, 2022 1:00 pm
by answerhappygod
Q22 Which Of The Following Are True W R T Context Api A Context Api Is Used To Share The Date Between Multiple Componen 1
Q22 Which Of The Following Are True W R T Context Api A Context Api Is Used To Share The Date Between Multiple Componen 1 (117.8 KiB) Viewed 61 times
Context API
Q22 Which of the following are true w.r.t context API a) Context API is used to share the date between multiple components without the need of drilling the props down b) A context can be consumed only by using a consumer c) A context can be created using useContext hook d) We can create only one context within an application Q23 Which of the following is the correct way to create context and pass the props through Context Provider a. export const LanguageContext = createContext() <Language Context.Provider value={{lang: 'en'}}> {this.props.children] </LanguageContext.Provider> b. export const LanguageContext = createContext({lang:'fr'}) <LanguageContext.Provider value={{lang:'en'}}> {this.props.children] </LanguageContext.Provider> c. export const LanguageContext = createContext({lang:'fr'}) <LanguageContext.Provider prop={lang: 'en'}> {this.props.children] </LanguageContext.Provider> d. export const Language Context = createContext() <LanguageContext.Provider prop={{lang:'en'}}> {this.props.children] </LanguageContext.Provider> 12/14 a) Both a and b b) Only a c) Only b d) Both b and d