Exercise 1: Why the Scanning Code Can't Be Shared as a Component — Possible Solution ==================================================================== WHY IT CAN'T BE SHARED AS A SINGLE REUSABLE UNIT ------------------------------ React's component/hook model packages both markup and JavaScript behavior together into a single, portable unit that can be dropped into a different React application largely unmodified - which is exactly how the two React-based sibling courses share one identical scanning component between them. Django has no equivalent construct: it has no built-in way to package a piece of JavaScript behavior alongside its markup as one portable, reusable frontend unit that another (potentially non-Django) project could just import directly. WHAT DJANGO OFFERS INSTEAD ------------------------------ Django's own reuse tools are template inheritance and includes - {% extends %} and {% include %} - which let one template's markup be reused or extended by another template within the same Django project. WHY THIS IS A COARSER-GRAINED KIND OF REUSE ------------------------------ {% extends %} and {% include %} operate at the level of HTML markup structure, not JavaScript behavior - they let a chunk of template markup be reused, but they don't package a self-contained piece of interactive logic (like camera access and barcode detection) the way a React component does. Reusing the actual scanning behavior in this course means keeping it as its own JavaScript file and linking to it from multiple templates by hand, rather than importing one self-contained unit the way a React component could be. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly explains that React's component model bundles markup and behavior into one portable unit, unlike anything Django provides natively, and correctly identifies Django's template inheritance/includes as a markup-level, not behavior-level, reuse mechanism - a genuinely coarser-grained tool for a different kind of reuse.