TypeScript VS Jquery using for Razor page

Htet Lin 46 Reputation points
2020-12-03T00:46:45.613+00:00

Now I am developging using the Razor page with .Net Core . Please help me to to suggest
Shoud i used Typescript ro JQuery which one shoud i use ? Please advise . Thank you .

.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,130 questions
{count} vote

Accepted answer
  1. Jerry Cai-MSFT 986 Reputation points
    2020-12-03T03:30:23.76+00:00

    Hi,HtetLin-7338

    It's up to you, if you are used to using TypeScript, you can still use it because .net core supports it and it will be more suitable for creating

    large scale JavaScript-based applications.

    JQuery is a fast and concise JavaScript Library. About the difference and benefits about TypeScript and Jquery, you can check more details in following link:

    difference-between-typescript-and-javascript

    what-is-typescript

    Best Regards,
    Jerry Cai


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.
    0 comments No comments

10 additional answers

Sort by: Most helpful
  1. Nirpat Choudhary 10 Reputation points
    2024-01-30T07:51:12.52+00:00

    For Razor Pages, TypeScript is recommended over jQuery for several reasons. Few reasons to adopt TypeScript are: • Type Safety • Modern Development • Integration with ASP.NET • Maintainability and Scalability • Community and Support In summary, TypeScript is a more modern, type-safe, and maintainable choice for developing Razor Pages. It offers better integration with ASP.NET and aligns with contemporary web development practices.

    0 comments No comments

  2. M. Venkatesh 0 Reputation points
    2024-04-01T05:53:21.09+00:00

    Here is the list of technical comparison of TypeScript and JQuery for use with Razor pages:

    • TypeScript is a superset of JavaScript that primarily provides optional static typing, classes, and interfaces. It compiles to plain JavaScript. Using TypeScript allows for stronger type checking and IntelliSense support in code editors.
    • JQuery is a popular JavaScript library primarily used to simplify DOM manipulation, event handling, animation, and Ajax interactions. It works directly with plain JavaScript.
    • For Razor pages, TypeScript is better suited if strong typing is important. The static types make integrating TypeScript code with other .NET languages and frameworks like C# smoother. IntelliSense also helps with Razor code.
    • JQuery is simplest to get started with for DOM manipulation tasks. Its API is very mature and widely used so there are many examples and plugins available. However, it provides no type safety benefits.
    • A hybrid approach is also possible - use TypeScript for app logic/classes and JQuery for DOM tasks. This gives both static types and easy DOM access. Refer Detail articles for more details, if you still have questions or queries regarding TypeScript Vs JavaScript
        // TypeScript class
        class TodoItem {
          id: number;
          title: string; 
          constructor(id: number, title: string) {
            this.id = id;
            this.title = title;
          }
        }
        // Use JQuery for DOM task
        $("#todoList").append(`
          <li>
            <span>${todoItem.title}</span>
          </li>
        `);
        
      
    0 comments No comments