Hey, I've recently realized that a lot of my Shiny projects end up with most of the work done before the data gets to Shiny and the role of Shiny will end up only being data filtering and presentation.
If that is the case I reckon, it'd be better to have the page in HTML with the filtering done with JavaScript. The problem is, I don't know JavaScript.
So my question is if anyone knows of a good set of lessons to learn JavaScript specifically to replace a little bit of Shiny functionality? And, I'd love to hear any other experience of learning JavaScript coming from an R background.
Cheers, and I hope everyone has a lovely upcoming summer.
Custom message handlers will help you with this, specifically session$sendCustomMessage and Shiny.onInputChange or Shiny.setInputValue. Check out the Communicating with Shiny via JavaScript guide.
I would recommend Mozilla's JavaScript guide, as well as having a look through the html tutorials (for good semantic practices) and DOM guides (for a conceptual overview).
A bit about my experience - I started learning JavaScript when I when I wanted a specific actions to occur as a result of an event (button click for example). At the time, I didn't have much experience with other languages besides R (I come from the clinical research background). I started with looking at simple examples, reading guides, and practicing (lots of it and then repeating). Once I felt comfortable with the basics, I moved on to learning D3, data handling techniques in js, and then on to popular js libraries (reactJS, gatsbyJS, etc) for building static sites/apps. Recently, I've started learning using nodeJS and express to get familiar with backend work. It's been a few years, but taking that first step was a worth it.
Hope that helps! I'd be happy to answer any questions.
Hi @martj42! I was thrilled to find your question because I've been thinking about this exact problem a lot lately. I'll be leading a workshop at rstudio::conf 2020 on JavaScript for Shiny Users. The goal of the workshop is to help Shiny app developers with an R background learn the fundamentals of JavaScript and web development, while definitely keeping one foot firmly planted in R and Shiny.
I encourage you to take a look at the workshop; but even if you can't attend, I'll be sharing the workshop materials online in January 2020. I'll check back in here and post the links then.
In the mean time, here are a few high-quality resources for learning JavaScript.
JavaScript for Data Science by Maya Gans, Toby Hodges, and Greg Wilson. This book is avaiilable online for free and is an excellent and gentle introduction to JavaScript for scientists, engineers, and data scientists.