What is the most efficient way to display various content within multiple accordions? view image description here This is the current approach I am taking in my project, where shipping information and delivery options will involve different textboxes, labels, and input boxes.
Currently, I am manually coding each label, input box, and textbox for the different accordions, but I believe this method is not optimal. Hardcoding all these elements makes my code lengthy for just one page. Below is a snippet of how I am hardcoding everything. Should I consider splitting the different accordions into separate React classes to streamline the code?
<div className="dropdown-header" onClick={toggle}>
<h4 className="dropdown-text">Shipping Information</h4>
<span className="dropdown-selection">{selected ? '-' : '+'}</span>
</div>
{selected && (<div className="wrapper">
<div className="row">
<div className="col-md-6">
<div className="info-group mb-3">
<label>First Name</label>
<input type="text" className="info-input" name="firstname" />
</div>
</div>
<div className="col-md-6">
<div className="info-group mb-3">
<label>Last Name</label>
<input type="text" className="info-input" name="firstname" />
</div>