Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how can i use what i imported in another component in context API with arrow function

pls i wanted to use placeInfo,reviews,detailsInfo,news coming from data file. instead of putting value=’hello’ [import { placeInfo, reviews, detailsInfo, news } from '../data';<InfoContext.Provider value={placeInfo,reviews,detailsInfo,news} >][1]i doubt if i can use it direct like this value={placeInfo,reviews,detailsInfo,news} which is giving me error
or i should put it in var

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Wrap the value in an object like this value={{placeInfo, reviews, detailsInfo, news}}

or create the object on a separate line like this:

const value = {
   placeInfo,
   reviews,
   detailsInfo,
   news
};

Then pass it as value={value}

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading