Hi, I’m not sure if anyone here has worked with Blazor much but hopefully somone can help on this issue.

I’m trying to make a search feature where on inputting something in the searchbar, the MainLayout replaces the the Body with a component and updates the list on input, but when the search bar is empty it shows the Body again.

My problem: if I try this with without trying to replace, so, just render the component at the start, it works without issues. but if I try to render the component only after I input anything I get this error “Object reference not set to an instance of an object.” I just dont know if I can have a way to preload the component on initialization when done this way.

if (setVisible){<BrowseList ref=”BrowseList” /> }

else {Body}

If anyone has any idea on how to sold this, please let me know, if needed more information do ask. thank you.

source