#Fetching data from client component using app router

1 messages · Page 1 of 1 (latest)

mild summit
#

For instance getting selected filtered value from user interaction :

const selectChange = (event: any) => {
    setStatus(event.target.value)
  }

  const options = Object.keys(TaskStatus)

  return (
    <div className="flex items-center justify-between border-b border-gray-200 pb-5">
      <div className="text-lg text-gray-700 font-medium">
        My tasks
      </div>
      <select onChange={selectChange} name="status" className="block focus:ring-indigo-500 focus:border-indigo-500 shadow-sm sm:text-sm border-gray-300 rounded-md">
        {options.map((option: any, index: number) => (
          <option key={index} value={option}>{option}</option>
        ))
        }
      </select>
    </div>
  )
misty haven
#

Yeah, the filters and all that is client component, the filter state is in the url, and you fetch from that url.

mild summit
#

Oh yeah good point

misty haven
#

Nice, try that, if it helps your condition

mild summit
#

Yes it's exactly helping me from what I need to do. Thank you 😉
But still have you find a way using fetch from client component ? I asume sometimes we have no choice

mild summit
#

No idea ?

misty haven
#

WDYM?