Comments (9)
Hi Chandra. That's not "the React way". React needs to be created using its virtual dom, not text or using setinnerhtml. I strongly suggest you work within those constraints. If for whatever reason you really really want to do this anyway, try asking in the React mailing list. Good luck.
from scalajs-react.
I am reading some blog posts from tumblr API ,they are html , in my app i am trying to render them inside react component. In JSX gotchas i found this line to render html
http://facebook.github.io/react/docs/jsx-gotchas.html
<div dangerouslySetInnerHTML={{__html: 'First · Second'}} />
how can i achieve in scala-js react ?
or is there any other way i can make this workout ..
Thank You
Chandra
from scalajs-react.
Oh so dangerouslySetInnerHTML
is React attribute? I didn't know that. In that can you can create attributes as you need them.
It should be something like this:
val dangerouslySetInnerHTML = "dangerouslySetInnerHTML".attr
...
div(dangerouslySetInnerHTML := "blah blah blah")
from scalajs-react.
reacts dangerouslySetInnerHTML attribute accepts jsObject with key __html and value string
in scala i am trying like this
val dangerouslySetInnerHTML = "dangerouslySetInnerHTML".attr
val htmlObj = js.Dynamic.literal("__html"" -> text)
div(dangerouslySetInnerHTML := htmlObj )
but scalatags attribute doesn't accept js.Object :(
from scalajs-react.
Usage: div(dangerouslySetInnerHtml("<span>"))
from scalajs-react.
thank you , is artifact published ?
from ivy cache i removed reactjs
rm -rf com.github.japgolly.*
refreshed sbt ,but still i don't see this attribute ?
from scalajs-react.
No I haven't published yet. You can run sbt publishLocal
to use 0.5.2-SNAPSHOT until 0.5.2 final is published.
from scalajs-react.
I tried to do:
<.pre(^.dangerouslySetInnerHTML := ???)
But got:
[error] .../LogsPage.scala:31: value dangerouslySetInnerHTML is not a member of object japgolly.scalajs.react.vdom.HtmlAttrAndStyles
[error] ^.dangerouslySetInnerHTML := ???,
But the thing is that I can see the definition of dangerouslySetInnerHTML
.
Do you know what's wrong here?
from scalajs-react.
Alright it's not dangerouslySetInnerHTML
but dangerouslySetInnerHtml
from scalajs-react.
Related Issues (20)
- Export `assertOuterHTML` HOT 1
- Deprecate `Mounted` component types HOT 2
- Add default arg to `ReactTestUtils.withRendered` HOT 1
- ScalaFnComponent is anonymous HOT 2
- Consider using `DocumentFragments` in `ReactTestUtils` HOT 1
- Re-evaluate `ComponentDom` post- React 18
- Is there a way to integrate Components with cats.effect.Ref? HOT 1
- Ref not always set HOT 2
- Syntax to integrate `useContext` with context function in Scala 3 HOT 1
- Compilation fails in Scala 3 when deriving Reusability for case classes with multiple parameter groups HOT 1
- Missing getDerivedStateFromError
- Missing / misspelled packages in MODULES.md HOT 1
- Add support for Discussions tab in Github HOT 1
- Modern testing recipe?
- Cannot mix static and dynamic routes even if conditional
- A minimal setup fails with Scala 3 HOT 5
- Provide default IO/SyncIO error handler for component
- ScalaFnComponent doesn't include displayName HOT 1
- Another way to define hook components
- AsyncCallback + cats, gracefully handling errors with EitherT: unexpected behaviour HOT 1
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 scalajs-react.