Comments (7)
Thanks @RacingTadpole - is it always when2? I have a feeling it's actually going in reverse sequential order.
from jsx-control-statements.
Yes - it looks like it is, maybe due to this line: https://github.com/AlexGilleran/jsx-control-statements/blob/master/src/chooseStatement.js#L72 . When I remove the reverse()
all the tests still pass, and the test above passes too. I'll submit a PR for that.
We could just define the reverse behaviour to be correct, but that's pretty different from what you'd expect from the analogy with "if-elseif-else". (Eg. the original discussion of this included an example a lot like this, with the "WhenBlock1" answer.)
from jsx-control-statements.
Yeah agree re: the order.
Any thoughts @texttechne ?
from jsx-control-statements.
Ahh, I see my mistakes. The most important one is having missed to test ordering 😃
The second mistake is all about reversed ordering.
- The array of children is reduced from the right side (l.17), so the ordering of
when
blocks gets reversed. - This is the reason I intended to revert them back in the mentioned line 72.
- Actually this is wrong, because the ternary expression itself is built up from right to left (l.73), which requires reversed ordering...
So @RacingTadpole is completely right with his analysis and bugfix. 👍
from jsx-control-statements.
We should leave this issue open until it is released.
from jsx-control-statements.
Released as v3.1.1 :)
from jsx-control-statements.
👍
from jsx-control-statements.
Related Issues (20)
- The control statements don't narrow TypeScript types HOT 1
- TypeScript type for children is missing a render function HOT 1
- TChildren conflicts with ReactNode children HOT 2
- Why do we need ```transform-react-inline-elements``` plugin ?
- Switch-case style control statement HOT 2
- Problem with ./node_modules/tsx-control-statements/components.ts HOT 3
- Typo error HOT 1
- Support babel macros HOT 2
- conditional statements don't work unless wrapped in brackets. is this supposed to happen? HOT 1
- Not working with laravel-mix with webpack config
- Can you provide plugins for swc HOT 1
- Can you provide a version based on swc core? HOT 1
- Uncaught ReferenceError: For is not defined HOT 5
- Not working with create-react-app HOT 7
- If is not defined HOT 4
- App breaks if i try to directly access the url - With Error - Choose is not defined HOT 1
- React-Native:Installation-Guide HOT 2
- last published version is 3 years old HOT 2
- ESLint autofix HOT 2
- Undefined is not a function with new JSX transform with react 17 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsx-control-statements.