reactjs - Add class names to React root component or change structure -
i trying use flexbox react component root div being inserted. can't add class names root div (omitted).
i think split out smaller components not sure how?
this how structure now:
this how structure:
current (trimmed down) app.js code:
const hit = ({hit}) => <div classname="col-xl-3 col-lg-4 col-md-6 col-sm-12 d-flex align-items-stretch var-result"> <div classname="card"> <div classname="card-block"> <div classname="row flex-wrap"> <div classname="col-md-8"><h4><highlight attributename="name" hit={hit}/></h4></div> <div classname="col-md-4 text-right"> <img src={hit.image} classname="img-fluid" alt=""/> </div> </div> <p classname="d-inline-block db-name">database name</p> <p classname="d-inline-block vendor-name">${hit.price}</p> <p classname="card-text small"><highlight attributename="description" hit={hit}/></p> </div> </div> </div> const searchresultcontent = () => <section classname="row grey-bg mt-5 overflow-y"> <hits hitcomponent={hit} classname="d-flex flex-wrap"/> </section> class app extends component { render() { return ( <instantsearch appid="latency" apikey="3d9875e51fbd20c7754e65422f7ce5e1" indexname="bestbuy"> <headernav /> <div classname="container-fluid"> <div classname="row"> <sidebar/> <main/> <searchresultcontent/> </div> </div> </instantsearch> ); } } export default app;
the classnames not added inserted root element.
<hits hitcomponent={hit} classname="d-flex flex-wrap"/>
Comments
Post a Comment