How to use role based authentication on client side reactjs?
I have created 2 components one is login form and other component displays table with some random data generated through faker.js After user login, table component with some data is displayed. That component also has 2 buttons on top right corner so I want to show those buttons only if user === ADMIN
if user === USER
then I don't want to show those 2 buttons. How can I do this ? Should I create a separate component excluding those 2 buttons ?
Login.js:
import React, {Component} from "react";
import { Button, Form, Header } from "semantic-ui-react";
import './loginForm.css';
class LoginForm extends Component {
state = {}
handleChange = (e, { name, value }) => this.setState({ [name]: value })
handleSubmit = () => {
this.setState({ urnNumber: '', password: '' })
this.props.history.push('/user')
}
render() {
const { urnNumber, password } = this.state
return(
<Form className="formStyle" onSubmit={this.handleSubmit}>
<Header className="title" as='h1'>Account Portal Login</Header>
<Header className="info" as='h5'>Please login with your URN number. If you have not been assigned a
password, you can create one below and login afterwards</Header>
<Header className="info" as='h4'>Please login below</Header>
<Form.Field>
<Form.Input label="URN number" value={urnNumber} placeholder="Enter URN number" onChange={this.handleChange}/>
</Form.Field>
<Form.Field>
<Form.Input label="Password" value={password} placeholder="Enter password" onChange={this.handleChange}/>
</Form.Field>
<Button className="loginButton">Login</Button>
</Form>
)
}
};
export default LoginForm;
TableComponent.js:
const RemittancePage = () => (
<Grid className={styles.container}>
<Grid.Row>
<Grid.Column width={11}>
<Header as='h2' className={styles.title}>Remittance Page</Header>
</Grid.Column>
<Grid.Column floated='right' width={5}>
<Button primary className={styles.formButton}>Remittance</Button>
<Button primary className={styles.reportButton}>Generate Report + </Button>
</Grid.Column>
</Grid.Row>
<Grid.Row>
<Grid.Column width={16}>
<Table celled selectable className={styles.remittanceForm}>
<Table.Header>
<Table.Row>
<Table.HeaderCell>ID</Table.HeaderCell>
<Table.HeaderCell>Name</Table.HeaderCell>
<Table.HeaderCell>URN number</Table.HeaderCell>
<Table.HeaderCell>Parishes</Table.HeaderCell>
<Table.HeaderCell>Remittance</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>{faker.random.number()}</Table.Cell>
<Table.Cell>{faker.name.findName()}</Table.Cell>
<Table.Cell>{faker.random.number()}</Table.Cell>
<Table.Cell>{faker.address.streetAddress()}</Table.Cell>
<Table.Cell>{faker.date.weekday()}</Table.Cell>
</Table.Row>
// Some more rows
</Table.Body>
</Table>
</Grid.Column>
</Grid.Row>
</Grid>
)
export default RemittancePage;
App.js:
var user1 = {
"number": "123",
"role": "ADMIN"
};
var user2 = {
"number": "456",
"role": "USER"
};
class App extends Component {
render() {
return (
<Router>
<Switch>
<div>
<Route exact path="/" component={LoginForm}/>
{/* <Route path="/user" component={RemittancePage} /> */}
<Route path="/user" render={(user1) => <RemittancePage {...user1} />}
/>
<Route path="/remittanceform" component={RemittanceForm} />
</div>
</Switch>
</Router>
);
}
}
export default App;
Screenshot:
In below screenshot 2 buttons in top right should be displayed only if user == ADMIN
if user === USER
then I don't want to display it. How can I do this ?
javascript reactjs
add a comment |
I have created 2 components one is login form and other component displays table with some random data generated through faker.js After user login, table component with some data is displayed. That component also has 2 buttons on top right corner so I want to show those buttons only if user === ADMIN
if user === USER
then I don't want to show those 2 buttons. How can I do this ? Should I create a separate component excluding those 2 buttons ?
Login.js:
import React, {Component} from "react";
import { Button, Form, Header } from "semantic-ui-react";
import './loginForm.css';
class LoginForm extends Component {
state = {}
handleChange = (e, { name, value }) => this.setState({ [name]: value })
handleSubmit = () => {
this.setState({ urnNumber: '', password: '' })
this.props.history.push('/user')
}
render() {
const { urnNumber, password } = this.state
return(
<Form className="formStyle" onSubmit={this.handleSubmit}>
<Header className="title" as='h1'>Account Portal Login</Header>
<Header className="info" as='h5'>Please login with your URN number. If you have not been assigned a
password, you can create one below and login afterwards</Header>
<Header className="info" as='h4'>Please login below</Header>
<Form.Field>
<Form.Input label="URN number" value={urnNumber} placeholder="Enter URN number" onChange={this.handleChange}/>
</Form.Field>
<Form.Field>
<Form.Input label="Password" value={password} placeholder="Enter password" onChange={this.handleChange}/>
</Form.Field>
<Button className="loginButton">Login</Button>
</Form>
)
}
};
export default LoginForm;
TableComponent.js:
const RemittancePage = () => (
<Grid className={styles.container}>
<Grid.Row>
<Grid.Column width={11}>
<Header as='h2' className={styles.title}>Remittance Page</Header>
</Grid.Column>
<Grid.Column floated='right' width={5}>
<Button primary className={styles.formButton}>Remittance</Button>
<Button primary className={styles.reportButton}>Generate Report + </Button>
</Grid.Column>
</Grid.Row>
<Grid.Row>
<Grid.Column width={16}>
<Table celled selectable className={styles.remittanceForm}>
<Table.Header>
<Table.Row>
<Table.HeaderCell>ID</Table.HeaderCell>
<Table.HeaderCell>Name</Table.HeaderCell>
<Table.HeaderCell>URN number</Table.HeaderCell>
<Table.HeaderCell>Parishes</Table.HeaderCell>
<Table.HeaderCell>Remittance</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>{faker.random.number()}</Table.Cell>
<Table.Cell>{faker.name.findName()}</Table.Cell>
<Table.Cell>{faker.random.number()}</Table.Cell>
<Table.Cell>{faker.address.streetAddress()}</Table.Cell>
<Table.Cell>{faker.date.weekday()}</Table.Cell>
</Table.Row>
// Some more rows
</Table.Body>
</Table>
</Grid.Column>
</Grid.Row>
</Grid>
)
export default RemittancePage;
App.js:
var user1 = {
"number": "123",
"role": "ADMIN"
};
var user2 = {
"number": "456",
"role": "USER"
};
class App extends Component {
render() {
return (
<Router>
<Switch>
<div>
<Route exact path="/" component={LoginForm}/>
{/* <Route path="/user" component={RemittancePage} /> */}
<Route path="/user" render={(user1) => <RemittancePage {...user1} />}
/>
<Route path="/remittanceform" component={RemittanceForm} />
</div>
</Switch>
</Router>
);
}
}
export default App;
Screenshot:
In below screenshot 2 buttons in top right should be displayed only if user == ADMIN
if user === USER
then I don't want to display it. How can I do this ?
javascript reactjs
Isuser
something you have in state? Is iturnNumber
or something else?
– Ryan Cogswell
Nov 21 '18 at 13:14
@RyanC I am not using backend or database I have hardcoded 2 users one is admin and other is user
– fun joker
Nov 21 '18 at 13:20
Hardcoded where? Where is user defined/set?
– Ryan Cogswell
Nov 21 '18 at 13:24
@RyanC See updated app.js
– fun joker
Nov 21 '18 at 15:51
1
I still don't see how you're getting the user. In<Route path="/user" render={(user1) => <RemittancePage {...user1} />} />
, user1 is going to be the route props (reacttraining.com/react-router/web/api/Route/route-props) not youruser1
variable declared at the top of App.js (see this code sandbox: codesandbox.io/s/nnzwz247rj as demonstration).
– Ryan Cogswell
Nov 22 '18 at 2:31
add a comment |
I have created 2 components one is login form and other component displays table with some random data generated through faker.js After user login, table component with some data is displayed. That component also has 2 buttons on top right corner so I want to show those buttons only if user === ADMIN
if user === USER
then I don't want to show those 2 buttons. How can I do this ? Should I create a separate component excluding those 2 buttons ?
Login.js:
import React, {Component} from "react";
import { Button, Form, Header } from "semantic-ui-react";
import './loginForm.css';
class LoginForm extends Component {
state = {}
handleChange = (e, { name, value }) => this.setState({ [name]: value })
handleSubmit = () => {
this.setState({ urnNumber: '', password: '' })
this.props.history.push('/user')
}
render() {
const { urnNumber, password } = this.state
return(
<Form className="formStyle" onSubmit={this.handleSubmit}>
<Header className="title" as='h1'>Account Portal Login</Header>
<Header className="info" as='h5'>Please login with your URN number. If you have not been assigned a
password, you can create one below and login afterwards</Header>
<Header className="info" as='h4'>Please login below</Header>
<Form.Field>
<Form.Input label="URN number" value={urnNumber} placeholder="Enter URN number" onChange={this.handleChange}/>
</Form.Field>
<Form.Field>
<Form.Input label="Password" value={password} placeholder="Enter password" onChange={this.handleChange}/>
</Form.Field>
<Button className="loginButton">Login</Button>
</Form>
)
}
};
export default LoginForm;
TableComponent.js:
const RemittancePage = () => (
<Grid className={styles.container}>
<Grid.Row>
<Grid.Column width={11}>
<Header as='h2' className={styles.title}>Remittance Page</Header>
</Grid.Column>
<Grid.Column floated='right' width={5}>
<Button primary className={styles.formButton}>Remittance</Button>
<Button primary className={styles.reportButton}>Generate Report + </Button>
</Grid.Column>
</Grid.Row>
<Grid.Row>
<Grid.Column width={16}>
<Table celled selectable className={styles.remittanceForm}>
<Table.Header>
<Table.Row>
<Table.HeaderCell>ID</Table.HeaderCell>
<Table.HeaderCell>Name</Table.HeaderCell>
<Table.HeaderCell>URN number</Table.HeaderCell>
<Table.HeaderCell>Parishes</Table.HeaderCell>
<Table.HeaderCell>Remittance</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>{faker.random.number()}</Table.Cell>
<Table.Cell>{faker.name.findName()}</Table.Cell>
<Table.Cell>{faker.random.number()}</Table.Cell>
<Table.Cell>{faker.address.streetAddress()}</Table.Cell>
<Table.Cell>{faker.date.weekday()}</Table.Cell>
</Table.Row>
// Some more rows
</Table.Body>
</Table>
</Grid.Column>
</Grid.Row>
</Grid>
)
export default RemittancePage;
App.js:
var user1 = {
"number": "123",
"role": "ADMIN"
};
var user2 = {
"number": "456",
"role": "USER"
};
class App extends Component {
render() {
return (
<Router>
<Switch>
<div>
<Route exact path="/" component={LoginForm}/>
{/* <Route path="/user" component={RemittancePage} /> */}
<Route path="/user" render={(user1) => <RemittancePage {...user1} />}
/>
<Route path="/remittanceform" component={RemittanceForm} />
</div>
</Switch>
</Router>
);
}
}
export default App;
Screenshot:
In below screenshot 2 buttons in top right should be displayed only if user == ADMIN
if user === USER
then I don't want to display it. How can I do this ?
javascript reactjs
I have created 2 components one is login form and other component displays table with some random data generated through faker.js After user login, table component with some data is displayed. That component also has 2 buttons on top right corner so I want to show those buttons only if user === ADMIN
if user === USER
then I don't want to show those 2 buttons. How can I do this ? Should I create a separate component excluding those 2 buttons ?
Login.js:
import React, {Component} from "react";
import { Button, Form, Header } from "semantic-ui-react";
import './loginForm.css';
class LoginForm extends Component {
state = {}
handleChange = (e, { name, value }) => this.setState({ [name]: value })
handleSubmit = () => {
this.setState({ urnNumber: '', password: '' })
this.props.history.push('/user')
}
render() {
const { urnNumber, password } = this.state
return(
<Form className="formStyle" onSubmit={this.handleSubmit}>
<Header className="title" as='h1'>Account Portal Login</Header>
<Header className="info" as='h5'>Please login with your URN number. If you have not been assigned a
password, you can create one below and login afterwards</Header>
<Header className="info" as='h4'>Please login below</Header>
<Form.Field>
<Form.Input label="URN number" value={urnNumber} placeholder="Enter URN number" onChange={this.handleChange}/>
</Form.Field>
<Form.Field>
<Form.Input label="Password" value={password} placeholder="Enter password" onChange={this.handleChange}/>
</Form.Field>
<Button className="loginButton">Login</Button>
</Form>
)
}
};
export default LoginForm;
TableComponent.js:
const RemittancePage = () => (
<Grid className={styles.container}>
<Grid.Row>
<Grid.Column width={11}>
<Header as='h2' className={styles.title}>Remittance Page</Header>
</Grid.Column>
<Grid.Column floated='right' width={5}>
<Button primary className={styles.formButton}>Remittance</Button>
<Button primary className={styles.reportButton}>Generate Report + </Button>
</Grid.Column>
</Grid.Row>
<Grid.Row>
<Grid.Column width={16}>
<Table celled selectable className={styles.remittanceForm}>
<Table.Header>
<Table.Row>
<Table.HeaderCell>ID</Table.HeaderCell>
<Table.HeaderCell>Name</Table.HeaderCell>
<Table.HeaderCell>URN number</Table.HeaderCell>
<Table.HeaderCell>Parishes</Table.HeaderCell>
<Table.HeaderCell>Remittance</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>{faker.random.number()}</Table.Cell>
<Table.Cell>{faker.name.findName()}</Table.Cell>
<Table.Cell>{faker.random.number()}</Table.Cell>
<Table.Cell>{faker.address.streetAddress()}</Table.Cell>
<Table.Cell>{faker.date.weekday()}</Table.Cell>
</Table.Row>
// Some more rows
</Table.Body>
</Table>
</Grid.Column>
</Grid.Row>
</Grid>
)
export default RemittancePage;
App.js:
var user1 = {
"number": "123",
"role": "ADMIN"
};
var user2 = {
"number": "456",
"role": "USER"
};
class App extends Component {
render() {
return (
<Router>
<Switch>
<div>
<Route exact path="/" component={LoginForm}/>
{/* <Route path="/user" component={RemittancePage} /> */}
<Route path="/user" render={(user1) => <RemittancePage {...user1} />}
/>
<Route path="/remittanceform" component={RemittanceForm} />
</div>
</Switch>
</Router>
);
}
}
export default App;
Screenshot:
In below screenshot 2 buttons in top right should be displayed only if user == ADMIN
if user === USER
then I don't want to display it. How can I do this ?
javascript reactjs
javascript reactjs
edited Nov 21 '18 at 15:50
fun joker
asked Nov 21 '18 at 13:02
fun jokerfun joker
398110
398110
Isuser
something you have in state? Is iturnNumber
or something else?
– Ryan Cogswell
Nov 21 '18 at 13:14
@RyanC I am not using backend or database I have hardcoded 2 users one is admin and other is user
– fun joker
Nov 21 '18 at 13:20
Hardcoded where? Where is user defined/set?
– Ryan Cogswell
Nov 21 '18 at 13:24
@RyanC See updated app.js
– fun joker
Nov 21 '18 at 15:51
1
I still don't see how you're getting the user. In<Route path="/user" render={(user1) => <RemittancePage {...user1} />} />
, user1 is going to be the route props (reacttraining.com/react-router/web/api/Route/route-props) not youruser1
variable declared at the top of App.js (see this code sandbox: codesandbox.io/s/nnzwz247rj as demonstration).
– Ryan Cogswell
Nov 22 '18 at 2:31
add a comment |
Isuser
something you have in state? Is iturnNumber
or something else?
– Ryan Cogswell
Nov 21 '18 at 13:14
@RyanC I am not using backend or database I have hardcoded 2 users one is admin and other is user
– fun joker
Nov 21 '18 at 13:20
Hardcoded where? Where is user defined/set?
– Ryan Cogswell
Nov 21 '18 at 13:24
@RyanC See updated app.js
– fun joker
Nov 21 '18 at 15:51
1
I still don't see how you're getting the user. In<Route path="/user" render={(user1) => <RemittancePage {...user1} />} />
, user1 is going to be the route props (reacttraining.com/react-router/web/api/Route/route-props) not youruser1
variable declared at the top of App.js (see this code sandbox: codesandbox.io/s/nnzwz247rj as demonstration).
– Ryan Cogswell
Nov 22 '18 at 2:31
Is
user
something you have in state? Is it urnNumber
or something else?– Ryan Cogswell
Nov 21 '18 at 13:14
Is
user
something you have in state? Is it urnNumber
or something else?– Ryan Cogswell
Nov 21 '18 at 13:14
@RyanC I am not using backend or database I have hardcoded 2 users one is admin and other is user
– fun joker
Nov 21 '18 at 13:20
@RyanC I am not using backend or database I have hardcoded 2 users one is admin and other is user
– fun joker
Nov 21 '18 at 13:20
Hardcoded where? Where is user defined/set?
– Ryan Cogswell
Nov 21 '18 at 13:24
Hardcoded where? Where is user defined/set?
– Ryan Cogswell
Nov 21 '18 at 13:24
@RyanC See updated app.js
– fun joker
Nov 21 '18 at 15:51
@RyanC See updated app.js
– fun joker
Nov 21 '18 at 15:51
1
1
I still don't see how you're getting the user. In
<Route path="/user" render={(user1) => <RemittancePage {...user1} />} />
, user1 is going to be the route props (reacttraining.com/react-router/web/api/Route/route-props) not your user1
variable declared at the top of App.js (see this code sandbox: codesandbox.io/s/nnzwz247rj as demonstration).– Ryan Cogswell
Nov 22 '18 at 2:31
I still don't see how you're getting the user. In
<Route path="/user" render={(user1) => <RemittancePage {...user1} />} />
, user1 is going to be the route props (reacttraining.com/react-router/web/api/Route/route-props) not your user1
variable declared at the top of App.js (see this code sandbox: codesandbox.io/s/nnzwz247rj as demonstration).– Ryan Cogswell
Nov 22 '18 at 2:31
add a comment |
1 Answer
1
active
oldest
votes
You can just use the following structure inside of your RemittancePage jsx template:
this.props.user.permissions === 'ADMIN' ? <Grid.Column floated='right' width={5}>
<Button primary className={styles.formButton}>Remittance</Button>
<Button primary className={styles.reportButton}>Generate Report + </Button>
</Grid.Column> : null
Assuming you have user
passed to props.
Basically, same as in plain JS. Just an inline conditional.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412652%2fhow-to-use-role-based-authentication-on-client-side-reactjs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can just use the following structure inside of your RemittancePage jsx template:
this.props.user.permissions === 'ADMIN' ? <Grid.Column floated='right' width={5}>
<Button primary className={styles.formButton}>Remittance</Button>
<Button primary className={styles.reportButton}>Generate Report + </Button>
</Grid.Column> : null
Assuming you have user
passed to props.
Basically, same as in plain JS. Just an inline conditional.
add a comment |
You can just use the following structure inside of your RemittancePage jsx template:
this.props.user.permissions === 'ADMIN' ? <Grid.Column floated='right' width={5}>
<Button primary className={styles.formButton}>Remittance</Button>
<Button primary className={styles.reportButton}>Generate Report + </Button>
</Grid.Column> : null
Assuming you have user
passed to props.
Basically, same as in plain JS. Just an inline conditional.
add a comment |
You can just use the following structure inside of your RemittancePage jsx template:
this.props.user.permissions === 'ADMIN' ? <Grid.Column floated='right' width={5}>
<Button primary className={styles.formButton}>Remittance</Button>
<Button primary className={styles.reportButton}>Generate Report + </Button>
</Grid.Column> : null
Assuming you have user
passed to props.
Basically, same as in plain JS. Just an inline conditional.
You can just use the following structure inside of your RemittancePage jsx template:
this.props.user.permissions === 'ADMIN' ? <Grid.Column floated='right' width={5}>
<Button primary className={styles.formButton}>Remittance</Button>
<Button primary className={styles.reportButton}>Generate Report + </Button>
</Grid.Column> : null
Assuming you have user
passed to props.
Basically, same as in plain JS. Just an inline conditional.
answered Nov 21 '18 at 13:15
Daniil Andreyevich BaunovDaniil Andreyevich Baunov
1,042527
1,042527
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53412652%2fhow-to-use-role-based-authentication-on-client-side-reactjs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Is
user
something you have in state? Is iturnNumber
or something else?– Ryan Cogswell
Nov 21 '18 at 13:14
@RyanC I am not using backend or database I have hardcoded 2 users one is admin and other is user
– fun joker
Nov 21 '18 at 13:20
Hardcoded where? Where is user defined/set?
– Ryan Cogswell
Nov 21 '18 at 13:24
@RyanC See updated app.js
– fun joker
Nov 21 '18 at 15:51
1
I still don't see how you're getting the user. In
<Route path="/user" render={(user1) => <RemittancePage {...user1} />} />
, user1 is going to be the route props (reacttraining.com/react-router/web/api/Route/route-props) not youruser1
variable declared at the top of App.js (see this code sandbox: codesandbox.io/s/nnzwz247rj as demonstration).– Ryan Cogswell
Nov 22 '18 at 2:31