Если вы получаете эту ошибку из MiniProfiler в MVC, вы можете увеличить значение, установив свойство MiniProfiler.Settings.MaxJsonResponseSize
на нужное значение. По умолчанию этот инструмент игнорирует значение, установленное в config.
MiniProfiler.Settings.MaxJsonResponseSize = 104857600;
Предоставлено mvc-mini-profiler .
Поскольку вы упомянули react-router | react-router-dom
в v4
, вы можете сделать это одним из следующих способов:
A
<Link
className="btn btn-primary" // some bootstrap class
to={{
pathname: "/watch",
state: { posterId: poster.id } // I am assuming post has id
}}
/>
WatchComponent
class WatchComponent extends React.Component {
componentDidMount() {
const { posterId } = this.props.location.state;
//make ajax request to the server and get poster details
//promise resolve, set response into state
// this.setState({ poster: res.json()})
}
render() {
const { poster } = this.state;
return (
// render poster details here.
)
}
}
Или Вы можете просто сделать это
<Link
className="btn btn-primary" // some bootstrap class
to={`/watch/${posterId}`} // provided that Route of WatchComponent is defined as (URL parameter) <Route path="watch/:posterId" component={WatchComponent} />
/>
затем в WatchComponent вы делаете
class WatchComponent extends React.Component {
componentDidMount() {
const { posterId } = this.props.macth.params;
//make ajax request to the server and get poster details
//promise resolve, set response into state
// this.setState({ poster: res.json()})
}
render() {
const { poster } = this.state;
return (
// render poster details here.
)
}
}