Coder Social home page Coder Social logo

Comments (9)

donnysim avatar donnysim commented on July 19, 2024 1

Ok, so I found the culprit, if you have an event listener, it stops updating with jsx version (or when using plain createVNode instead of h). Same repo codesandbox

from babel-plugin-jsx.

Amour1688 avatar Amour1688 commented on July 19, 2024 1

#33

from babel-plugin-jsx.

donnysim avatar donnysim commented on July 19, 2024

It seems it uses createVNode, which does not work in this case I guess?

from babel-plugin-jsx.

Amour1688 avatar Amour1688 commented on July 19, 2024
import {
  ref, Transition, createApp, defineComponent,
} from 'vue';

const MyTransition = (_, { slots }) => (
  <Transition>{slots.default()}</Transition>
);

const App = defineComponent({
  setup() {
    const isOpen = ref(false);
    setInterval(() => { isOpen.value = !isOpen.value; }, 1000);
    return () => <MyTransition>{isOpen.value && <h1>Visible</h1>}</MyTransition>;
  },
});

It works.

try

const MyTransition = (_, { slots }) => (
  <Transition>{slots.default()}</Transition>
);

from babel-plugin-jsx.

donnysim avatar donnysim commented on July 19, 2024

It seems it does not have anything to do with a hoc, I made a reproduction codesandbox red text is vue h, bluetext is jsx. Main code is in /src/Toggle.vue. I tried reproducing it with my use case so it could be a bit more than actually necessary for it to start failing.

Edit: wait, just noticed that it works the other way around which is strange. In my local case jsx is the one not working, in codesandbox it's vue that is not working... this is so confusing :|
Edit 2: something is really messed up, now they both work...

from babel-plugin-jsx.

donnysim avatar donnysim commented on July 19, 2024

I'll just close this until I get what is going on, sorry for wasting your time ๐Ÿ˜“

from babel-plugin-jsx.

Amour1688 avatar Amour1688 commented on July 19, 2024

I'll just close this until I get what is going on, sorry for wasting your time ๐Ÿ˜“

It's fine. Thanks for your issue.

from babel-plugin-jsx.

donnysim avatar donnysim commented on July 19, 2024

Seems to work with the fix ๐Ÿ‘

from babel-plugin-jsx.

Amour1688 avatar Amour1688 commented on July 19, 2024

v1.0.0-beta.4

from babel-plugin-jsx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.