From fb1ad96d6a4b9ae28e5726c2ec7882e23c6271cc Mon Sep 17 00:00:00 2001 From: waterwu Date: Fri, 1 Jul 2016 15:20:08 +0800 Subject: [PATCH 1/3] Update withRouter.js add support for `getWrappedInstance` inspired by `react-redux` --- modules/withRouter.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/withRouter.js b/modules/withRouter.js index e9e7f32fda..63dea58aa3 100644 --- a/modules/withRouter.js +++ b/modules/withRouter.js @@ -9,8 +9,11 @@ function getDisplayName(WrappedComponent) { export default function withRouter(WrappedComponent) { const WithRouter = React.createClass({ contextTypes: { router: routerShape }, + getWrappedInstance(){ + return this.refs.wrappedInstance; + } render() { - return + return } }) From 56bf23c80d9fbf189222b7a50e0406716df5ecb3 Mon Sep 17 00:00:00 2001 From: waterwu Date: Fri, 1 Jul 2016 15:23:13 +0800 Subject: [PATCH 2/3] Update withRouter.js --- modules/withRouter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/withRouter.js b/modules/withRouter.js index 63dea58aa3..6c9e02a349 100644 --- a/modules/withRouter.js +++ b/modules/withRouter.js @@ -11,7 +11,7 @@ export default function withRouter(WrappedComponent) { contextTypes: { router: routerShape }, getWrappedInstance(){ return this.refs.wrappedInstance; - } + }, render() { return } From 1b5b26cb4ae8e2bff23f4dab1660f571e2408e98 Mon Sep 17 00:00:00 2001 From: waterwu Date: Fri, 1 Jul 2016 15:26:46 +0800 Subject: [PATCH 3/3] Update withRouter.js --- modules/withRouter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/withRouter.js b/modules/withRouter.js index 6c9e02a349..35c489de28 100644 --- a/modules/withRouter.js +++ b/modules/withRouter.js @@ -9,8 +9,8 @@ function getDisplayName(WrappedComponent) { export default function withRouter(WrappedComponent) { const WithRouter = React.createClass({ contextTypes: { router: routerShape }, - getWrappedInstance(){ - return this.refs.wrappedInstance; + getWrappedInstance() { + return this.refs.wrappedInstance }, render() { return