Socket
Socket
Sign inDemoInstall

@vitejs/plugin-vue-jsx

Package Overview
Dependencies
Maintainers
5
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vitejs/plugin-vue-jsx

Provides Vue 3 JSX & TSX support with HMR.


Version published
Weekly downloads
636K
increased by2.05%
Maintainers
5
Weekly downloads
 
Created

What is @vitejs/plugin-vue-jsx?

@vitejs/plugin-vue-jsx is a Vite plugin that provides support for Vue 3 JSX syntax. It allows developers to write Vue components using JSX, which can be more familiar to those coming from a React background or those who prefer JSX syntax over Vue's template syntax.

What are @vitejs/plugin-vue-jsx's main functionalities?

Basic JSX Support

This feature allows you to write Vue components using JSX syntax. The code sample demonstrates a simple Vue component that renders a div with the text 'Hello, JSX!'.

import { defineComponent } from 'vue';

const MyComponent = defineComponent({
  render() {
    return <div>Hello, JSX!</div>;
  }
});

export default MyComponent;

Props Handling

This feature allows you to define and use props in your JSX components. The code sample shows a component that takes a 'message' prop and renders it inside a div.

import { defineComponent } from 'vue';

const MyComponent = defineComponent({
  props: {
    message: String
  },
  render() {
    return <div>{this.message}</div>;
  }
});

export default MyComponent;

Event Handling

This feature allows you to handle events in your JSX components. The code sample demonstrates a button that shows an alert when clicked.

import { defineComponent } from 'vue';

const MyComponent = defineComponent({
  methods: {
    handleClick() {
      alert('Button clicked!');
    }
  },
  render() {
    return <button onClick={this.handleClick}>Click me</button>;
  }
});

export default MyComponent;

Other packages similar to @vitejs/plugin-vue-jsx

FAQs

Package last updated on 09 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc