Archives : February-2017

Is there a way to nest routes in React Router v4? This works: <Router basename=’/app’> <main> <Route path=’/’ component={AppBar} /> <Route path=’/customers’ component={Customers} /> </main> </Router> This does not: <Router basename=’/app’> <Route path=’/’ component={AppBar}> <Route path=’/customers’ component={Customers} /> </Route> </Router> Customers Component: import React, { Component, PropTypes } from ‘react’ import styled from ‘styled-components’ export ..

Read more

I’d like to display a title in <AppBar /> that is somehow passed in from the current route. In React Router v4, how would <AppBar /> be able to get the current route passed into it’s title prop? <Router basename=’/app’> <main> <Menu active={menu} close={this.closeMenu} /> <Overlay active={menu} onClick={this.closeMenu} /> <AppBar handleMenuIcon={this.handleMenuIcon} title=’Test’ /> <Route path=’/customers’ ..

Read more

I have a component like that: <Parent> <Child/> </Parent> and <Child/> component have a method foo. I want test the foo method but I don’t know how to access it. I tried: mount(<Parent><Child/></Parent>).props().children.foo or mount(<Parent><Child/></Parent>).children().foo but both them are undefined. I can’t use .instance() because it’s not root. I can’t mount <Child/> only because the ..

Read more

I have a React single page application using React Router that hooks into a Rails 5 API. The Rails application uses devise_token_auth for authentication. I’ve successfully created an authentication process that stores the user state in a Redux store on the client side. Each user of the application belongs to a company. Each company has ..

Read more