1

For some time I've been developing a django rest/react app. I'm still a newbie in this topic and most of the time I apply just-working solutions to my project.

Gradually I'm lerning new things. There is this topic that bothers me.

In my app I have this like 'main view' with a nav bar and a drawer (simply from material-ui). In drawer I've declared some buttons for navigation. Now the only view/layout changing is this empty space excluding nav bar and drawer (on the left). So it's facebook-like layout (with only middle part changing when navigating trough main stream or groups/pages).

Those buttons in drawer use history.push() from react, as it was easiest to apply, but I wonder is it the right way ? Django has it's redirections, shouldn't I use those ?

There is not much of a comparison between history and redirect. Something interesting I've found is: React-Router - Link vs Redirect vs History .

Also, I've implemented a simple login and django auth, but with axios.posting I'm able to trace this this request in browsers network. Is there a better, or more important a safer way of requesting ?

Wiktoor
  • 72
  • 8

1 Answers1

1

The only ways to navigate through the frontend client (React) are react-routers history, window's history (https://developer.mozilla.org/en-US/docs/Web/API/Window/history), and any way that creates an < a > link. When it makes sense, always opt for a way that creates an < a > link because it's better for indexing your website (https://developers.google.com/search/docs/advanced/guidelines/hidden-text-links).

Django's redirect usage: request comes to django -> redirect to another server

All user network requests are interceptible and can mostly be protected using HTTPS.

dizzidude
  • 113
  • 1
  • 5