-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support JSX as a pragma #9
base: master
Are you sure you want to change the base?
Conversation
import * as React from 'react'; | ||
import * as Adapter from 'enzyme-adapter-react-16'; | ||
import * as Enzyme from 'enzyme'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider turning on esModuleInterop
?
2062fa5
to
be77893
Compare
@@ -376,6 +376,83 @@ See [`@cycle/react-native`](https://github.com/cyclejs/react-native). | |||
</p> | |||
</details> | |||
|
|||
<details> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: GitHub's "Display the rich diff" will help.
Fixes cyclejs#8 Implementation of `jsxFactory` is just a copy and paste from @sliptype's pull request (cyclejs/react-dom#3). Test cases have been rewritten in a DOM-free way (using enzyme).
```js | ||
plugins: [ | ||
new webpack.ProvidePlugin({ | ||
jsxFactory: ['@cycle/react', 'jsxFactory'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line was originally
jsxFactory: ['react-dom', 'jsxFactory']
But I believe 'react-dom'
was a mistake for '@cycle/react-dom'
, so now it is '@cycle/react'
.
@@ -0,0 +1,36 @@ | |||
import {createElement, ReactElement, ReactType} from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is a copy and paste of https://github.com/cyclejs/react-dom/blob/229e592ab80998ace5bf4fd0c12eee36f4499731/src/jsx-factory.ts, except for import path of incorporate
funciton.
The original filename was kebab case (jsx-factory.tsx
), but I've renamed to camel case, following the naming convention of this repository.
@@ -0,0 +1,83 @@ | |||
import * as React from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test cases have been almost rewritten in a DOM-free way (using enzyme
's shallow rendering).
The next one, however, was difficult to rewrite with my limited knowledge.
Any good ideas?
"jsx": "react", | ||
"jsxFactory": "jsxFactory.createElement" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of configuring jsx
and jsxFactory
here?
Or should we separately have test/tsconfig.json
instead?
Fixes #8
Implementation of
jsxFactory
is just a copy and paste from @sliptype'spull request (cyclejs/react-dom#3).
Test cases have been rewritten in a DOM-free way (using enzyme).
There are still some points that I'm not sure, so I'll leave this to be a draft.
I'll add some inline comments.