ReactJs Difference between Button and Link in React reactjs difference between props and state,reactjs difference between class

I want to convert my <button> to a <Link>. But I keep getting an error.

Warning: Failed prop type: Invalid prop `to` supplied to `Link`.

My code looks like this.

import React from 'react';
import { Link } from 'react-router-dom';
import { auth } from '../firebase';

const SignOutButton = () =>
<button
  type="button"
  onClick={auth.doSignOut}
>
  Sign Out
</button>

export default SignOutButton

I want something like this

import React from 'react';
import { Link } from 'react-router-dom';
import { auth } from '../firebase';

const SignOutButton = () =>
<Link
  to={auth.doSignOut}
>
  Sign Out
</Link>

export default SignOutButton

Because the styling of the Link is different and just to know why it does not work.

Answer:1



  1. reactjs difference between props and state
  2. reactjs difference between class and function
  3. reactjs difference between component and container
  4. reactjs difference between
  5. difference reactjs angularjs
  6. difference reactjs angular
  7. difference reactjs and javascript
  8. react reactjs difference

I am trying to integrate react-select using redux form... Here is my code import Select from 'react-select' import StyledSelectField, { StyledMessages } from './style' const SelectField = props =&...

I am trying to integrate react-select using redux form... Here is my code import Select from 'react-select' import StyledSelectField, { StyledMessages } from './style' const SelectField = props =&...

I am learning react and redux and trying to implement login .. below is my routing import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; import Login from './...

I am learning react and redux and trying to implement login .. below is my routing import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; import Login from './...