Access content from createData without creating a new component #4623
Replies: 1 comment 2 replies
-
What do you mean by "access content", where do you want to access this data exactly and what does it contain? createData/addRoute is mostly useful when you want a route component to receive the data as props You can import/require any json file anywhere in your React code, so you can just write There is also a "global data" API that you can use to create some data that will be available everywhere by default Keep in mind that you should avoid using such API if the data is useful in only a subset of pages, because it will increase the weight of all your pages of your site (including the homepage) |
Beta Was this translation helpful? Give feedback.
-
Hey there 👋 ,
is there a way to access content created via
createData
without usingaddRoute
? Something like:but where
someting-rad
is created like so:Beta Was this translation helpful? Give feedback.
All reactions