Skip to content
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

Add JSX pragma #3

Merged
merged 10 commits into from
Jun 6, 2019
Merged

Add JSX pragma #3

merged 10 commits into from
Jun 6, 2019

Conversation

sliptype
Copy link
Contributor

@sliptype sliptype commented Jun 1, 2019

As described in cyclejs/react#3 this PR adds a JSX pragma to allow rendering React components using JSX in Cycle:

import { jsxFactory } from '@cycle/react-dom';

function view(state$: Stream<State>): Stream<ReactElement> {
    return state$.map(({ count }) => (
        <div>
            <h2>Counter: {count}</h2>
            <button sel="add">Add</button>
            <button sel="subtract">Subtract</button>
        </div>
    ));
}

@staltz
Copy link
Member

staltz commented Jun 3, 2019

Thanks for the PR! Some comments inline...

@sliptype
Copy link
Contributor Author

sliptype commented Jun 3, 2019

No problem!

Could you double check that you submitted the comments, I don't see any

readme.md Outdated
loader: 'babel-loader',
options: {
plugins: [
['transform-react-jsx', { pragma: jsxFactory.createElement' }],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a dangling single quote in this line that is breaking the markdown syntax afterwards

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sliptype good catch! fixed in 27832ba

@staltz staltz merged commit 2a06a07 into cyclejs:master Jun 6, 2019
@staltz
Copy link
Member

staltz commented Jun 6, 2019

Thank you @sliptype! Great PR, nice bonus with the tests

ryota-ka added a commit to ryota-ka/react that referenced this pull request May 7, 2020
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).
ryota-ka added a commit to ryota-ka/react that referenced this pull request May 7, 2020
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).
ryota-ka added a commit to ryota-ka/react that referenced this pull request May 7, 2020
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).
ryota-ka added a commit to ryota-ka/react that referenced this pull request May 7, 2020
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants