Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vue/babel-plugin-jsx

Package Overview
Dependencies
Maintainers
4
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue/babel-plugin-jsx

Babel plugin for Vue 3 JSX

  • 1.2.0-alpha.0
  • alpha
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created

What is @vue/babel-plugin-jsx?

@vue/babel-plugin-jsx is a Babel plugin that allows you to use JSX syntax in Vue.js applications. It provides a way to write Vue components using JSX, which can be more familiar to developers coming from a React background. This plugin helps in writing more expressive and concise component code.

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

Basic JSX Syntax

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!'.

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

Using Props

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

const MyComponent = { props: ['message'], render() { return <div>{this.message}</div> } }

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.

const MyComponent = { render() { return <button onClick={() => alert('Clicked!')}>Click Me</button> } }

Conditional Rendering

This feature allows you to perform conditional rendering in your JSX components. The code sample shows a component that renders 'Show' or 'Hide' based on the value of the 'show' data property.

const MyComponent = { data() { return { show: true } }, render() { return this.show ? <div>Show</div> : <div>Hide</div> } }

Loop Rendering

This feature allows you to render lists in your JSX components. The code sample demonstrates a component that renders a list of items using the map function.

const MyComponent = { data() { return { items: [1, 2, 3] } }, render() { return <ul>{this.items.map(item => <li>{item}</li>)}</ul> } }

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

FAQs

Package last updated on 25 Sep 2023

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