Understanding High Order Components with ExamplesHigher-Order Components (HOCs) are a pattern in React for reusing component logic. An HOC is a function that takes a component and returns a new component with additional props or functionality. Key Points about HOCs: HOCs are Pure Functions: They d...Jul 8, 2024·3 min read
Async vs Defer: How They Differ and Which Option is BestBoth async and defer are attributes that can be added to the <script> tag in HTML to control how external JavaScript files are loaded and executed. Normal Script : In this when script tag encounter then browser stops Html parsing and start fetching s...Jul 3, 2024·3 min read
Security Concerns When Using innerHTMLUsing innerHTML to insert content into a web page can introduce security risks, primarily Cross-Site Scripting (XSS) attacks. //Unsafe Implementation (Vulnerable to XSS) // User input can contain malicious scripts let userInput = "<img src='x' onerro...Jul 2, 2024·3 min read
Understanding the Differences: innerHTML, innerText, and textContentLet's read the content of the nav element using all three properties to see the difference. <nav> <a>Home</a> <a>About</a> <a>Contact</a> <a style="display: none">Pricing</a> </nav> innerHTML : It give Html tag + content . // Reading conten...Jul 2, 2024·2 min read