Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules/
.module-cache
*.log
yarn.lock
.idea/
104 changes: 55 additions & 49 deletions demo/index.js
Original file line number Diff line number Diff line change
@@ -1,65 +1,71 @@
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, Link, browserHistory } from 'react-router';
import React from 'react';
import ReactDOM from 'react-dom/client';
import {BrowserRouter as Router, Routes, Route} from 'react-router-dom'
import {Link} from 'react-router-dom'
import FacebookLogin from '../src/facebook';
import FacebookLoginWithButton from '../src/facebook-with-button'
import FacebookLoginWithButton from '../src/facebook-with-button';

const responseFacebook = (response) => {
console.log(response);
};

class Base extends Component {
render() {
return (
<div>
<Link to="/dummy">Route to dummy page</Link>
const Base = () => {

<div>
<p>Facebook login with default button and styling</p>
<FacebookLoginWithButton
appId="1088597931155576"
autoLoad
callback={responseFacebook}
icon="fa-facebook"
/>
</div>
return (
<div>
<Link to="/dummy">Route to dummy page</Link>

<div>
<p>Facebook login with render prop (and no styling provided out the box)</p>
<FacebookLogin
appId="1088597931155576"
autoLoad
callback={responseFacebook}
render={renderProps => (
<button onClick={renderProps.onClick}>This is my custom FB button</button>
)}
/>
</div>
<div>
<p>Facebook login with default button and styling</p>
<FacebookLoginWithButton
appId="668219527577200"
autoLoad
callback={responseFacebook}
icon="fa-facebook"
/>
</div>
);
}
}

class Dummy extends Component {
render() {
return (
<div>
<Link to="/">Back</Link>
<h1>
This is just a dummy page to test the button<br />
<a href="https://github.com/keppelen/react-facebook-login/pull/76#issuecomment-262098946">
survives back and forth routing
</a>
</h1>
<p>Facebook login with render prop (and no styling provided out the box)</p>
<FacebookLogin
appId="668219527577200"
autoLoad
callback={responseFacebook}
render={renderProps => (
<button onClick={renderProps.onClick}>This is my custom FB button</button>
)}
/>
</div>
);
}
</div>
);
}

const Dummy = () => {

return (
<div>
<Link to="/">Back</Link>
<h1>
This is just a dummy page to test the button<br/>
<a href="https://github.com/keppelen/react-facebook-login/pull/76#issuecomment-262098946">
survives back and forth routing
</a>
</h1>
</div>
);
}

ReactDOM.render(
<Router history={browserHistory}>
<Route path="/" component={Base}/>
<Route path="/dummy" component={Dummy}/>
</Router>,
const root = ReactDOM.createRoot(
document.getElementById('demo')
);

root.render(
<React.StrictMode>
<Router>
<Routes>
<Route path="/" element={<Base/>}/>
<Route path="/dummy" element={<Dummy/>}/>
</Routes>
</Router>
</React.StrictMode>
);
Loading