Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Issue 1 #6

Merged
merged 4 commits into from
Sep 26, 2017
Merged

Issue 1 #6

merged 4 commits into from
Sep 26, 2017

Conversation

Kunalgarg2100
Copy link
Contributor

No description provided.

(<div>
<a class="button float-left" href={prev}>Prev</a>
<a class="button float-right" href={nxt}>Next</a></div>)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be done much more neatly.

<div>
 {qno !== 1 && .....prev....}
 {qno !== 5 && .....next....}
</div>

res = await res.json();
if (!res.error) this.setState({ question: res, loading: false })
else this.setState({ error: res.error, loading: false })
}
render() {
const { loading, question, error } = this.state
const quesno = parseInt(this.props.params.qno,10)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name it as qno please for consistency

res = await res.json();
if (!res.error) this.setState({ question: res, loading: false })
else this.setState({ error: res.error, loading: false })
}
render() {
const { loading, question, error } = this.state
const quesno = parseInt(this.props.params.qno,10)
const prev = `/question/${quesno-1}`
const nxt = `/question/${quesno+1}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to define as you will use them only once if you code it like I suggested. However your choice.

}
{
qno!==5 &&
<a class="button float-right" href={`/question/${qno+1}`}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use Link component instead of a like we do in navbar

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Difference is this will not cause the page to reload

@meghprkh meghprkh merged commit d90c179 into felicity-iiith:master Sep 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants