123
rated 0 times
[
126]
[
3]
/ answers: 1 / hits: 28969
/ 5 Years ago, fri, january 11, 2019, 12:00:00
Scroll to a particular div using id in react without using any other library, I found a few solutions they were using scroll libraries
here's the div code in my WrappedQuestionFormFinal component
<div className=form-section>
<Row>
<Col xs={24} xl={4} className=form-section-cols>
<h3 id={id}>
{t('QUESTION')} {t(id + 1)}
</h3>
</Col>
</Row>
</div>
it's a nested component called through this component here
<WrappedQuestionFormFinal
allQuestions={questions}
updateScreenTitle={this.props.updateScreenTitle}
handleDeleteQuestion={this.handleDeleteQuestion}
question={questions[q]}
dublicateQuestion={dubQuestion}
dependantQuestion={dependant}
id={i}
key={i}
tags={this.props.tags}
changeOrder={this.changeOrder}
changeScreenNo={this.changeScreenNo}
/>,
the problem I'm facing is this form has around 10 questions and in case of submission when error occurs I've to scroll the page where error occurs. the Id is given to h1 tag which is unique
More From » reactjs