Router redirecting to the another page

how to redirect to another page in react js on button click
react redirect to another page
react-router-dom redirect programmatically
redirect react-router
react redirect to another page programmatically
react onclick new page
react redirect to external url
react link to another page

I have route like

Route::get('admin/selfcontacteditdata','SelfcontectController@edit')->name('selfcontectedit');
Route::post('admin/selfcontactupdatedata','SelfcontectController@update')->name('selfcontectupdate');

If i just go to my browser and right admin/selfcontacteditdata it redirect me to

admin/newsshowdata

And my index function is

 public function __construct()
{
   return $this->middleware('auth');
}

public function index()
{

   request()->validate([
    'email' => 'required',
    'mobileno' => 'required',
    'facebook'=>'required',
     'google'=>'required',
      'map'=>'required',
    ]); 

    $data = selfcontect::find(1);
    return view('/admin/selfcontectedit',compact('data'));
}

And my middleware is

protected function redirectTo($request)
{
    if (! $request->expectsJson()) {
        return route('login');
    }
}

My rest admin routes are working fine.

I had the same problem but I was writing table name wrong and my file was not saved as .blade please check are you also doing the same thing and there is no meaning of validation in edit function your edit function must be like

public function edit()
{

$data = selfcontect::find(1);
return view('/admin/selfcontectedit',compact('data'));
}

and your function name should be edit

Redirecting in React. Sometimes you just want to get away…, Using a link to navigate to a new page with is pretty straightforward: a installed the React Router library, the easiest way to redirect to a new� I am new to React Router and learn that there are so many ways to redirect a page: Using browserHistory.push("/path") import { browserHistory } from 'react-router'; //do something browserHistory.

You should use Accept key not Content/type

How to redirect from one page to another page in React Router , In this tutorial, we are going to learn about how to redirect a user from one page to another page in react-router using component. Suppose… Well, the Redirect component replaces the page and therefore the user can't go back to the previous page. But, with the push method they can. However, you can use props.history.replace ('/) to mimic the Redirect behavior. Now let's move on and handle the case when the user hits a route that doesn't exist.

You can't redirect through view, actually your are calling view. Correct syntax is

return view('view_name',compact('data'));

If you want to redirect to any route you have to call like this

return redirect()->to('admin/selfcontacteditdata');

React Router Redirect: Programmatic Navigation in React using , The easiest way to use this method is by maintaining a redirect property inside the state of the component. Whenever you want to redirect to another path, you can simply change the state to re-render the component, thus rendering the <Redirect> component. It's pretty simple to redirect to another route url using redirectTo in angular application. but you maybe don't know so you can simple see bellow app-routing.module.ts file and see how i declare routes and how i redirect that home page to another route. You can see code of route define: {path: '', redirectTo: 'redirect_route_name', pathMatch

Redirect to a Route If in your routes.php file you have a route with a name, you can redirect a user to this particular route, whatever its URL is:

app/Http/routes.php:

get('books', ['as' => 'books_list', 'uses' => 'BooksController@index']);

app/Http/Controllers/SomeController.php

 return redirect()->route('books');

This is really useful if in the future you want to change the URL structure – all you would need to change is routes.php (for example, get(‘books’, … to get(‘books_list’, …), and all the redirects would refer to that route and therefore would change automatically.

And you can also use parameters for the routes, if you have any:

app/Http/routes.php:

 get('book/{id}', ['as' => 'book_view', 'uses' => 'BooksController@show']);
 app/Http/Controllers/SomeController.php

return redirect()->route('book_view', 1);

In case of more parameters – you can use an array:

app/Http/routes.php:

 get('book/{category}/{id}', ['as' => 'book_view', 'uses' => 
 'BooksController@show']);

app/Http/Controllers/SomeController.php

  return redirect()->route('book_view', [513, 1]);

Or you can specify names of the parameters:

  return redirect()->route('book_view', ['category'=>513, 'id'=>1]);

Redirecting the Router to Another Route, The pathMatch property, which is required for redirects, tells the router how it should match the URL provided in order to redirect to the specified route. const router = new VueRouter ({routes: [{path: '/a', redirect: to => {// the function receives the target route as the argument // return redirect path/location here. Note that Navigation Guards are not applied on the route that redirects, only on its target.

Redirect routes in react router, Lets see a basic example of how redirect component works in react router. Lets build a simple page which redirects to different pages based on� Re: Router redirecting to the login page. Disable QoS in Anti-Bufferbloats' menu, if you get full speed after that then it's a QoS settings issue. If you don't then its either a WiFi settings issue or client issue. Message 6 of 11.

A Complete Beginner's Guide to React Router (Including Router , Redirecting to another page. The React Router has another component named Redirect . As you guessed, it� It redirects "from" a URL "to" another URL. When the defined ion-route-redirect rule matches, the router will redirect from the path specified in the from property to the path in the to property. In order for a redirect to occur the from path needs to be an exact match to the navigated URL.

How to Set React Router Default Route Redirect to /home, How to Set React Router Default Route Redirect to /home Once the matching URL is found, then the matching page/component will be the <Router> is a parent component that wraps other child components as a <Route>� If you're using Vue Router you'll push the new URL onto the router in order to do a redirect: this.$router.push ('www.yoursite.com/blog'). In this short article we'll cover how to redirect to internal and external pages, if you're using Vue Router and if you're just using plain Vue. Redirect to internal page

Comments
  • Put your form here code
  • give me function code ..
  • I had added the edit function code please review
  • can you provide the edit method?
  • Yes my table name was different. It solved my problem