Skip to content

Add common props at _app.js level with caching functionality #1

@developerKumar

Description

@developerKumar

We should be able to access props at _app.js level, it can be declared as

`
const { fetchMediaDataFromCMS } = require('./service/mediaData.service');

module.exports = () => ({
'/_app': [{ key: 'mediaPosts', data: fetchMediaDataFromCMS }],
});
`

Also, if same function is called by another page let's say

`const { fetchMediaDataFromCMS } = require('./service/mediaData.service');

module.exports = () => ({
'/2021/[id]': [{ key: 'mediaPosts', data: fetchMediaDataFromCMS }],
'/2022/[id]': [{ key: 'mediaPosts', data: fetchMediaDataFromCMS }],
'/_app': [{ key: 'mediaPosts', data: fetchMediaDataFromCMS }],
});
`

then, it should load the data for other pages from cache of the library, should not call the same function to evaluate again and again.

Metadata

Metadata

Labels

duplicateThis issue or pull request already existsenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions