when I follow nested route like in example below, I don't want to every time call getInitialProps (because this is a modal, and I don't need every time fetch data )
Page with getInitialProps has Promise.all with 3 promises in it (requests), When I open modal or close I always got these 3 requests
Is there a way to prevent calling getInitialProps when change a route?
thank you
code from readme.md
`// ./src/Detail.js
import React from 'react';
import { Route } from 'react-router-dom';
class Detail extends React.Component {
// Notice that this will be called for
// /detail/:id
// /detail/:id/more "don't want to call getInitialProps"
// /detail/:id/other "don't want to call getInitialProps"
static async getInitialProps({ req, res, match }) {
const item = await CallMyApi(/v1/item${match.params.id});
return { item };
}
❓Question
when I follow nested route like in example below, I don't want to every time call getInitialProps (because this is a modal, and I don't need every time fetch data )
Page with getInitialProps has Promise.all with 3 promises in it (requests), When I open modal or close I always got these 3 requests
Is there a way to prevent calling getInitialProps when change a route?
thank you
code from readme.md `// ./src/Detail.js import React from 'react'; import { Route } from 'react-router-dom';
class Detail extends React.Component { // Notice that this will be called for // /detail/:id // /detail/:id/more "don't want to call getInitialProps" // /detail/:id/other "don't want to call getInitialProps" static async getInitialProps({ req, res, match }) { const item = await CallMyApi(
/v1/item${match.params.id}
); return { item }; }render() { return (
Detail
{this.props.item}} }
export default Detail;`