Skip to content

Commit a58be8c

Browse files
docs(common): components with same name KB
1 parent 60c3685 commit a58be8c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: Two Components with the Same Name
3+
description: Two components with the same (File) name can break your app
4+
type: troubleshooting
5+
page_title: Two Components with the Same Name
6+
slug: two-components-same-name
7+
position:
8+
tags:
9+
ticketid: 1422474
10+
res_type: kb
11+
---
12+
13+
When creating components, make sure that you use unique names for them and their file name. If the class name matches another component, you may get strange results, for example:
14+
15+
* You may get the Intellisense and features of one instead of the other, or a mix of both.
16+
* Compilation error.
17+
* Cryptic errors from things and Parameters that should work, such as *error CS0246: The type or namespace name 'TItem' could not be found (are you missing a using directive or an assembly reference?)*.
18+
19+
This last error message can be observed if you have a component called `TelerikGrid.razor` in your app, and you attempt to use the `<TelerikGrid>` component provided by Telerik UI for Blazor in the same app.
20+
21+
You will get the intellisense from the Telerik grid, you will be able to define columns and events, but setting its `Data` property will throw this build error because the framework will get confused with your own `TelerikGrid.razor` component.
22+
23+
The solution is to ensure that the component names in the project are unique, both across components in different folders of your own making, and with components from third party libraries you may be using.

0 commit comments

Comments
 (0)