/src/App.tsx
このRequiresTutorialRoute
で細工してある
const App = () => ( <Provider store={store}> <Router> <div id="app"> <IonApp> <IonSplitPane contentId="main"> <Menu /> <IonPage id="main"> <Switch> <PrivateRoute path="/account" component={Account} /> <Route path="/tutorial" component={Tutorial} /> <Route path="/logout" /> <RequiresTutorialRoute path="/login" component={Login} /> <RequiresTutorialRoute path="/support" component={Support} /> <RequiresTutorialRoute path="/signup" component={Signup} /> <RequiresTutorialRoute path="/" component={AppStack} /> </Switch> </IonPage> </IonSplitPane>` </IonApp> </div> </Router> </Provider> ); export default App;
Routing
src/utils/routing.tsx
RTRouteでかましてる
class RTRoute extends Component<Props> { render() { return ( <> {!this.props.user.hasSeenTutorial ? <Tutorial /> : null} <div style={!this.props.user.hasSeenTutorial ? { display: "none" } : {}}> <Route {...this.props} /> </div> </> ); } } const mapStateToProps = (state: RootState) => ({ user: state.user, }); export const PrivateRoute = connect(mapStateToProps)(PRoute); export const RequiresTutorialRoute = connect(mapStateToProps)(RTRoute);
export const sawTutorial = createAction("user/SAW_TUTORIAL", resolve => () => resolve(true));
アクション