Linked Questions

Popular Questions

React Admin dynamic url based on filters in return

Asked by At

I am quite beginners in coding. I have one question, hope you could help me ! I have a little function which returns a url and I try to make it dynamic, based on filters. I need to make my return dynamic, it means if one oof my filter is unset(so undefined), ex: q=undefined or size=undefined, so in my url I want to delete this part completely : "q":"${q}". my problem is this part of my url : `..."q":"${q}", "size":"${size}", "color":"${color}"}

 rowClick={(id, resource, record) => {
        const { q, size, color } = filterValues
        return `?filter={"details":"${record.details}","type":"product", "q":"${q}",  "size":"${size}", "color":"${color}"}`

I want my url in return was dynamic :/ no idea how to make it :(

Related Questions