From b8d87a5f869b6b57ff40326cb672d76beb875a76 Mon Sep 17 00:00:00 2001 From: Sherwin-14 Date: Sun, 4 Aug 2024 15:23:09 +0530 Subject: [PATCH 1/3] Removed @output decorator --- docs/comp-r-shiny.qmd | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/docs/comp-r-shiny.qmd b/docs/comp-r-shiny.qmd index 212fb7c5..bbcc330c 100644 --- a/docs/comp-r-shiny.qmd +++ b/docs/comp-r-shiny.qmd @@ -79,7 +79,6 @@ While R doesn't have an exact analog to decorators they are similar to [function ::: callout-tip ### Takeaways -- Decorate output function with `@output` - Use rendering decorators like `@render.plot`, `@render.text`, or `@render.ui` instead of `renderPlot()`, `renderText`, or `renderUI` - Reactive calculations (equivalent to reactive expressions in R) are decorated `@reactive.calc`, and reactive effects (equivalent to observers in R) are decorated with `@reactive.effect`. ::: @@ -120,7 +119,6 @@ app_ui = ui.page_fluid( ) def server(input, output, session): - @output @render.text def txt(): return f"n*2 is {input.n() * 2}" @@ -177,8 +175,7 @@ app_ui = ui.page_fluid( ui.output_text_verbatim("txt"), ) -def server(input, output, session): - @output +def server(input, output, session): @render.text def txt(): return f"n*2 is {input.n() * 2}" @@ -241,7 +238,6 @@ app_ui = ui.page_fluid( ) def server(input, output, session): - @output @render.text def txt(): return f"n*2 is {input.n() * 2}" @@ -304,7 +300,6 @@ def server(input, output, session): def n(): return input.n() - @output @render.text def txt(): return f"n*2 is {n() * 2}" @@ -407,7 +402,6 @@ def server(input, output, session): input.reset() ui.update_slider("n", value=40) - @output @render.text def txt(): return f"n*2 is {val() * 2}" @@ -535,7 +529,6 @@ def server(input: Inputs, output: Outputs, session: Session): newVal = val() + 1 val.set(newVal) - @output @render.text def value(): return str(val()) From c21ea2dc7e3c71308941a46bea3e720730affce9 Mon Sep 17 00:00:00 2001 From: Winston Chang Date: Mon, 5 Aug 2024 09:26:36 -0500 Subject: [PATCH 2/3] Remove trailing whitespace --- docs/comp-r-shiny.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/comp-r-shiny.qmd b/docs/comp-r-shiny.qmd index bbcc330c..46f01853 100644 --- a/docs/comp-r-shiny.qmd +++ b/docs/comp-r-shiny.qmd @@ -175,7 +175,7 @@ app_ui = ui.page_fluid( ui.output_text_verbatim("txt"), ) -def server(input, output, session): +def server(input, output, session): @render.text def txt(): return f"n*2 is {input.n() * 2}" From ef92af7544468289213fd2e025787bd0504dc366 Mon Sep 17 00:00:00 2001 From: Sherwin-14 Date: Mon, 2 Sep 2024 14:37:42 +0530 Subject: [PATCH 3/3] Fixed the broken link in the custom components page --- docs/custom-components-pkg.qmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/custom-components-pkg.qmd b/docs/custom-components-pkg.qmd index ceaa1661..624cfd0d 100644 --- a/docs/custom-components-pkg.qmd +++ b/docs/custom-components-pkg.qmd @@ -5,7 +5,7 @@ filters: --- -While there are a large number of pre-built [components available for Shiny,](components/) there are times when you may want to create your own. In this article we’ll walk through the process of creating a custom input component package for Shiny. We’ll be using React and Typescript to build the component, but the process is similar for other languages and frameworks. +While there are a large number of pre-built [components available for Shiny,](https://shiny.posit.co/py/components/) there are times when you may want to create your own. In this article we’ll walk through the process of creating a custom input component package for Shiny. We’ll be using React and Typescript to build the component, but the process is similar for other languages and frameworks. ::: {.callout-note} If you just want to build a one-off component for a single app, a full package may be overkill. See the accompanying article [Custom JavaScript component](custom-component-one-off.html) for a simpler approach.