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

[Question] Markup component for React? #9

Open
jschlieber opened this issue Jan 16, 2017 · 4 comments
Open

[Question] Markup component for React? #9

jschlieber opened this issue Jan 16, 2017 · 4 comments

Comments

@jschlieber
Copy link

Is there a React component that does a similar or even the same thing like preact-markup? Or is it possible to use preact-markup with React somehow? I don't want to fully switch to Preact right now, so this is not an option.

Thanks in advance!

@developit
Copy link
Owner

developit commented Jan 16, 2017

This library had originally been designed to work with either Preact or React, but the use of render arguments makes it Preact-specific. I'd be open to a PR to fix that. If fixed, you'd be able to do this

import React from 'react'
import ReactDOM from 'react-dom'
import Markup from 'preact-markup'

// tell Markup to use React VDOM elements
Markup.setReviver(React.createElement)

ReactDOM.render(
  <Markup markup="<strong>hello</strong>" />,
  document.body
)

@jschlieber
Copy link
Author

Thanks, will open a PR when I have time.

@robinvdvleuten
Copy link

I was looking into this as well. And one thing I ran into is the difference between h() and React.createElement(); Preact exposes a nodeName attribute and React exposes a type.

@robinvdvleuten
Copy link

And React's type is read-only 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants