Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
i have two views in my react Js , i have a toggle button that will toggle both views that is list and grid . how to add this using states?

These are the both views List and Grid. How do i add functionality to the toggle button using States.

<div>

- List item

{ this.state.articles.map((element) =>{
return <div className="media m-3 p-2" style={{border:"1px solid black"}}>
    <img className="mr-3 " src={element.thumb_url}style={{height:"50px", width:"50px"}} alt="Generic placeholder image"/>
        <div className="media-body">
            <h5 className="mt-0">{element.eventname}</h5>
           <p>{element.venue.street}</p>
           <p className="card-text"><small className="text-muted">on {element.start_time_display} </small></p>
           <a href={element.eventUrl} target="_blank" className="btn btn-sm btn-warning">View Details</a>
        </div>
</div>

<div className="container my-3">
//         <h3 className="text-center" style={{ margin: "35px 0px" }}>{document.title = `Discover Best Of Online Events [${this.props.category}]`}</h3>
//         When loading will true it shows sppinner 
//         {this.state.loading && <Spinner />}

//          {this.state.articles.map((element) => console.log(element))}

//         { under the className row all the elements are aligned one by one }
//         <div className="row my-4">
//         <div className="list-group"> 
//              when iterating the results from API it needs to give unique key 
//             {this.state.articles.map((element) => {
//                 return <div className="col-md-3" key={element.event_id}>
//                     <Events imageUrl={element.thumb_url_large} title={element.eventname} eventUrl={element.event_url} date={element.start_time_display} city={element.venue.city} />
//                 </div>
//             })}
//         </div>
//     </div> 
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!