We will create 3 dropdown filters based on the URL querystring. When the page loads, we will check if the URL contains any filters in the querystring, if it does we select by default that value in the dropdown.
We will use getServerSideProps to load all the makes. Material-ui is being used for style. The Make, min price and max price are dropdowns / material-ui Select.
The next description is a "Copy-paste" from Next.js Blog Post + Documentation:
When should I use getServerSideProps?
You should use getServerSideProps only if you need to pre-render a page whose data must be fetched at request time. Time to first byte (TTFB) will be slower than getStaticProps because the server must compute the result on every request, and the result cannot be cached by a CDN without extra configuration.
If you don’t need to pre-render the data, then you should consider fetching data on the client-side using SWR.
----
Github Repository: https://github.com/bmvantunes/youtube...
----
Follow me on:
Twitter: / bmvantunes
Dev.to: https://dev.to/bmvantunes
Website: https://brunoantunes.net
Github: https://github.com/bmvantunes
LinkedIn: / bmvantunes
Смотрите видео Next.js Building a Car Trader App #3: Filters based on URL querystring with Formik онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Bruno Antunes 11 Май 2020, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 13,541 раз и оно понравилось 298 людям.