'Why App or Quiz component rendered two times? [duplicate]

enter image description here

when I log any string in App component or Quiz component it appears two times in console.



Solution 1:[1]

This is because you are using StrictMode, which will cause multiple renders. This in intentionally done to help encourage developers use side effects properly. The double render will only happen in development and not in production.

Also see this answer for more information.

Strict mode is on because you have your components wrapped with <React.StrictMode>:

<React.StrictMode>
    <Router>
        ...
        ...
</React.StrictMode>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andrew Hulterstrom