Appsilon / shiny.react

Use React in Shiny applications.
https://appsilon.github.io/shiny.react
GNU Lesser General Public License v3.0
96 stars 12 forks source link

Support HTML in React context #66

Closed jakubsob closed 11 months ago

jakubsob commented 1 year ago

Closes #13

Test app

library(shiny)
library(shiny.react)

shinyApp(
  ui = tagList(
    ReactContext(
      HTML(
        "<div style='font-weight: bold;'>Hello</div>"
      )
    ),
    reactOutput("react_output")
  ),
  server = function(input, output) {
    output$react_output <- renderReact({
      HTML(
        "<div style='font-weight: bold;'>Hello</div>"
      )
    })
  }
)

image

@kamilzyla Are there more cases which we should support?

codecov-commenter commented 1 year ago

Codecov Report

Merging #66 (a7ae791) into main (6e2e837) will increase coverage by 62.57%. The diff coverage is 100.00%.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

@@            Coverage Diff             @@
##            main      #66       +/-   ##
==========================================
+ Coverage   9.72%   72.29%   +62.57%     
==========================================
  Files          5        5               
  Lines        144      148        +4     
==========================================
+ Hits          14      107       +93     
+ Misses       130       41       -89     
Files Changed Coverage Δ
R/reactData.R 52.17% <100.00%> (+45.03%) :arrow_up:

... and 4 files with indirect coverage changes

jakubsob commented 1 year ago

Thanks @averissimo, that was great review. I resolved your comments and added a few shinytest2 tests to capture this behavior that is implemented in this PR. PTAL 😉