Could use some help. I'm trying to make a similar search component for a database and I messed something up, could anyone help? I think this is the relevant section...
const unflattenResults = (results) => results.map((resident) => { const { id, firstname, nickname, spousename, lastname, address, secondaddress, thirdaddress, email, phone, organization, groupmembership, notes, } = resident; return { id, residents: { firstname, groupmembership, email, address, lastname, phone, organization, nickname, spousename, secondaddress, thirdaddress, notes, }, }; }); export default function HomePage({ data }) { const homepage = data.homepage.nodes; const residents = data.residents.nodes; const { index, store } = data.ressearch.nodes; const { search } = window.location; const queryify = new URLSearchParams(search).get('s'); const [searchQuery, setSearchQuery] = useState(queryify || ''); const results = useFlexSearch(searchQuery, index, store); const findings = unflattenResults(results); return ( <> <SearchBar searchQuery={searchQuery} setSearchQuery={setSearchQuery} /> <ResidentStyles> {residents.map((resident) => ( <section className="card" key={resident.id}> <p className="title">{resident.firstname}</p> </section> ))} </ResidentStyles> </>
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Could use some help. I'm trying to make a similar search component for a database and I messed something up, could anyone help? I think this is the relevant section...