Structure your app: introduction to Shiny modules
Channel: R Consortium
Date: 2021-08-08

Jonas Hagenberg presents on Structuring apps and gives an introduction to Shiny modules. 

In this tutorial, Jonas gives an introduction to modules, their advantages over simple R functions, and how existing functionality can be transferred to modules.

For an easy start, Jonas covers common pitfalls needed to overcome for productive use of modules:
- Passing reactive objects to modules
- Returning reactive values from the module to the calling environment
- Nesting modules
- Dynamically generating modules (including UI)

The contents of the tutorial are delivered by short lectures followed by hands-on coding sessions in break-out rooms. For this, you need a basic knowledge of reactive programming/Shiny.

Main Sections

0:00 Introduction
3:43 Recap: reactive programming
7:12 Ways to reduce code complexity
9:53 What are shiny modules
11:40 General structure 
13:29 Module structure
17:38 Namespacing - 1
19:59 Namespacing - 2
21:04 Demo
29:34 Namespacing -2 
31:26 Input values 1 and 2
32:28 When to use modules?
33:09 Exercise 1: write your first module
39:34 Module communication
39:48 Reactive inputs - 1-6
50:00 Reactive Inputs
53:19 Output values from modules  1 and 2
56:03 Exercise 3a/b/c reactive outputs
57:39 Nesting
59:11 Where does a module live?
1:00:01 API change 1 and 2
1:01:14 What should be a module?
1:01:52 Summary and questions 

More Resources 

Main Site: https://www.r-consortium.org/ 
News: https://www.r-consortium.org/news 
Blog: https://www.r-consortium.org/news/blog 
Join: https://www.r-consortium.org/about/join 
Twitter: https://twitter.com/Rconsortium 
LinkedIn: https://www.linkedin.com/company/r-consortium/