I created the component NotFound
and it works fine when I go to a page that doesn\'t exist. But the same page it\'s appearing in all my pages, not only the one
Simply import Switch
from react-router-dom
and wrap all your Routes in the Switch Component. Also Important here is to note to keep your 404Page component at the very bottom(just before your switch ending tag) This way it will match each component with its route first. If it matches, it will render the component or else check the next one. Ultimately if none matching routes will be founded, it will render 404Page