ReactJS – How to access routing parameters from components other than router components

In React-router 1.0/2.0, the route parameters this.props.params can be accessed from the Route component-but there seems to be no supported method to access from the components deeply contained in the Route component above Parameters.

Data sorting can be accessed through context.location, but this will throw a warning that this has been deprecated.

Starting in the latest version of React Router, all context data has been deprecated to support this.context.router:

< p>

Only an object named router is added to context. Accessing this.context.history, this.context. location, and this.context.route are all deprecated. This new object contains the methods available from history (such as push , replace) along with setRouteLeaveHook.

Unfortunately, this does not include location data, so you need to pass it yourself to Child (non-route handler) component.

In React-router 1.0/2.0, the route parameters this.props.params can be accessed from the Route component-but there seems to be no support The method accesses the parameters from the components deeply contained in the Route component above.

Data sorting can be accessed through context.location, but this will throw a warning that this has been deprecated.< /p>

From in the latest Starting with version of React Router, all context data has been deprecated to support this.context.router:

Only an object named router is added to context. Accessing this.context.history, this.context.location, and this.context.route are all deprecated. This new object contains the methods available from history (such as push, replace) along with setRouteLeaveHook .

Unfortunately, this does not include location data, so you need to pass it yourself to the child (non-route handler) component.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1316 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.