Ewon TechForum
Providing technical solutions to technical requests


Talk2M and Single-page application
ktmachinex Offline
Junior Member
#1
Hi,

I'm currently trying to create a web page using the react framework and TypeScript. I was wondering if the Talk2M server supports SPA (Single-page application).

I'm trying to use a router which refresh a portion of my web page according to the link clicked.

It works perfectly fine when I access locally to my web page which is located on the ewon flexy 205 (ftp://[ewon ip address]/usr/dashboard/index.html).

The problem is that as soon as I use talk2m to connect to my ewon, the about and users links don't work anymore. See attachments to compare.

I've try using a BrowerRouter and an HashRouter but to no avail.

I've also tried to compare with what viewOn is doing, but there is no such thing an a link component in viewOn.

Here's the code I'm working with (taken from https://reacttraining.com/react-router/w...uick-start):

Code:
import React from "react";
import { BrowserRouter as Router, Switch, Route, Link } from "react-router-dom";

function Home() {
  return <h2>Home</h2>;
}

function About() {
  return <h2>About</h2>;
}

function Users() {
  return <h2>Users</h2>;
}

export default function App() {
  return (
    <Router>
      <div>
        <nav>
          <ul>
            <li>
              <Link to="/">Home</Link>
            </li>
            <li>
              <Link to="/about">About</Link>
            </li>
            <li>
              <Link to="/users">Users</Link>
            </li>
          </ul>
        </nav>

        {/* A <Switch> looks through its children <Route>s and
            renders the first one that matches the current URL. */}
        <Switch>
          <Route path="/about">
            <About />
          </Route>
          <Route path="/users">
            <Users />
          </Route>
          <Route path="/">
            <Home />
          </Route>
        </Switch>
      </div>
    </Router>
  );
}

Any help would be greatly appreciated.

Thanks,
ktmachinex


Attached Files
.jpg   custom web page locally.jpg (Size: 60,15 KB / Downloads: 9)
.jpg   custom web page with Talk2M.jpg (Size: 73,3 KB / Downloads: 8)
Reply



Possibly Related Threads…
21-01-2020, 04:35 PM
Last Post: LewisH304
24-09-2019, 04:39 PM
Last Post: simon
12-06-2019, 02:08 PM
Last Post: valentin.joigneau
30-04-2019, 02:19 PM
Last Post: simon
12-03-2018, 10:45 PM
Last Post: simon
19-01-2018, 09:03 AM
Last Post: MadhuriSalunkhe



Users browsing this thread:
1 Guest(s)



Theme © Ewon 2019 - Forum software by © MyBB - Cookie policy