Repository: rackt/react-router (js)

Issue:
React checksum fails when using server side rendering and basename
I made a demo repo for the issue https://github.com/wordofchristian/react-router-error-demo

Basically using a basename with react-router it will render the `<Link />` component with a different href between server and client:

```
Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:
 (client) ><a class="" href="/my-app/" data-reacti
 (server) ><a class="" href="/" data-reactid=".wst
```

The client rendered link has the basename of `/my-app` added correctly, but the server side link does not.

![](http://i.imgur.com/UA1GpkZ.png)

Pull request description:
Add back basename support in match()
Fixes #3003

Looks like we broke this inadvertently back in #2743. Specifically, we did so here: https://github.com/rackt/react-router/pull/2743#discussion_r48084686 

Users should use a custom history from now on, but this maintains BC with 1.0.

Patch:
diff --git a/modules/createMemoryHistory.js b/modules/createMemoryHistory.js
index d26f411e5..ff8ef2a44 100644
--- a/modules/createMemoryHistory.js
+++ b/modules/createMemoryHistory.js
@@ -1,4 +1,5 @@
 import useQueries from 'history/lib/useQueries'
+import useBasename from 'history/lib/useBasename'
 import baseCreateMemoryHistory from 'history/lib/createMemoryHistory'
 
 export default function createMemoryHistory(options) {
@@ -7,7 +8,7 @@ export default function createMemoryHistory(options) {
   // `useQueries` doesn't understand the signature
   const memoryHistory = baseCreateMemoryHistory(options)
   const createHistory = () => memoryHistory
-  const history = useQueries(createHistory)(options)
+  const history = useQueries(useBasename(createHistory))(options)
   history.__v2_compatible__ = true
   return history
 }


Test patch:
diff --git a/modules/__tests__/serverRendering-test.js b/modules/__tests__/serverRendering-test.js
index a1aabb3f2..55360b0c4 100644
--- a/modules/__tests__/serverRendering-test.js
+++ b/modules/__tests__/serverRendering-test.js
@@ -152,6 +152,16 @@ describe('server rendering', function () {
     })
   })
 
+  it('accepts a basename option', function (done) {
+    match({ routes, location: '/dashboard', basename: '/nasebame' }, function (error, redirectLocation, renderProps) {
+      const string = renderToString(
+        <RouterContext {...renderProps} />
+      )
+      expect(string).toMatch(/\/nasebame/)
+      done()
+    })
+  })
+
   describe('server/client consistency', function () {
     // Just render to static markup here to avoid having to normalize markup.