Back to articles
I stopped rewriting the same 95 lines of JavaScript and built this instead

I stopped rewriting the same 95 lines of JavaScript and built this instead

via Dev.to PythonKetan Vishwakarma

Every Django project I've worked on had the same moment. Somewhere around week two, you're writing a data table. You write the fetch. You write the render. You wire up sorting. You add pagination. You handle the empty state and the error state. You add the delete button with a confirm dialog and a toast. You look at the file and it's 95 lines for something every web app needs. Then you do it again on the next project. Same 95 lines, different API URL. I did that enough times that I eventually just built a component for it. Then I built one for images. Then one for forms and more smart-elements. I spent the last few months turning all of that into declarative HTML Web Components. The idea is simple — instead of writing the logic, you describe what you want as attributes. A full data table with sorting, search, pagination, delete confirmation, toast notifications, and skeleton loading: <smart-table api-url= "/api/users/" response-map= '{"dataPath":"results","totalPath":"count"}' columns=

Continue reading on Dev.to Python

Opens in a new tab

Read Full Article
3 views

Related Articles