In the current version of React Router (v3), you can accept a server response and use browserHistory.push to go to the appropriate response page. However, this isn't available in v4 and you have to go about it a different way.

You can use the history methods outside of your components. Try by the following way.

First, create a history object used the history package:

// src/history.jsimport { createBrowserHistory } from 'history';export default createBrowserHistory();

Then wrap it in <Router> (please note, you should use import { Router } instead of import { BrowserRouter as Router }):

// src/index.jsx//…

There is a new useHistory hook in React Router >5.1.0 if you are using React >16.8.0 and functional components.

import { useHistory } from "react-router-dom";function HomeButton() {
const history = useHistory();
function handleClick() {
return (
<button type="button" onClick={handleClick}>
Go home

React Router v4

With v4 of React Router, there are three approaches that you can take to programmatic routing within components.

  1. Use the withRouter higher-order component.
  2. Use composition and render a <Route>
  3. Use the context.

React Router is mostly a wrapper around the history library. history handles interaction with the browser's window.history for…

And why ‘rapid prototyping’ isn’t enough to critically impact product design

Illustration: Mike Dodge

UX prototypes can be powerful tools to explore new design concepts, challenge preconceptions, validate assumptions, and bring designs to life. Their ultimate purpose is to facilitate learnings that help effect a better product. In my experience, prototypes that have had a critical impact on a product’s design were those that:

  1. Were conceived to address specific questions that were fundamental to the success of the design.
  2. Were executed quickly and early in the design process.
  3. And, provided clear direction on what to do next.

Why rapid prototyping isn’t enough

Over the past decade, the terms “rapid prototyping” and “iterative prototyping” have become synonymous in the UX…

How I built an Alexa-powered rotary phone with a Raspberry PI and some LEDs

TL;DR — I built Alexa into a rotary phone and setup the rotary dialer to trigger actions on my other Alexa devices.

1956 Western Electric Model 500, powered by Alexa

Parts required

  • an old rotary phone
  • a Raspberry PI 3
  • a bread board (used in development)
  • a USB mic (dismantled and rewired)
  • a 1/8" mono patch cable (rewired)
  • a couple of LEDs
  • three 10k resistors

How it came to be

Our family uses Alexa on a daily basis for things like playing music, getting the weather, and setting timers so the kids don’t fight over toys. For a handful of tasks, we prefer it to our mobile phones.

But there’s still some points of friction…

Mike Dodge

As Principal Design Technologist in Alexa Voice Shopping at Amazon, I design and build prototypes that define the future of voice and multi-model shopping.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store