SSR with react-router without redux

Hello friends .
I have been struggling with an issue for some time.
SSR works without react - router.
But when I use react-router, ssr no longer works.
i need Help.

its working while my App’s Codes are Simple like this :

import React from 'react';

export default () => <h1>you a Bitch!</h1>;

But During using React-Router it can’t Work

                    <Route path='/admin-panel/:path?' exact>
                                <Route path='/admin-panel' exact component={PanelAdminIndex} />
                                <Route path='/admin-panel/setting' component={PanelAdminSetting} />
                    <Route path='/user-panel/:path?' exact>
                                <Route path='/user-panel' exact component={PanelUserIndex} />
                                <Route path='/' exact component={PagesIndex} />
                                <Route path='/login' exact component={Login} />
                                <Route path='/register' exact component={Register} />

Note : All of that is while all of the Components is imported correctly.

i used this code in Server while its running :

import React from 'react';
import { renderToNodeStream } from 'react-dom/server';
import { onPageLoad } from 'meteor/server-render';

import {Routes} from '../client/Routes';

onPageLoad(sink => {
  sink.renderIntoElementById('App', renderToNodeStream(
    <Routes location={sink.request.url} />

I am facing this error at this time :

Cannot find module '../client/Routes'```

By default, server code will not be able to find any files under a folder named “client”

1 Like