df <- data.frame(
numeric = as.numeric(c(1, NA)),
logical = as.logical(c(1, NA)),
character = as.character(c(1, NA)),
factor = as.factor(c(1, NA))
)
reactable::reactable(
df,
defaultColDef = reactable::colDef(
na = "–"
),
onClick = reactable::JS("
function(rowInfo, column) {
alert(rowInfo.row[column.name]);
}"
)
)
Clicking on the missing value in the first column will say "NA", whereas in the other columns it'll say "null". This is problematic because in order to differentiate true NA from the string "NA" we need to look at the column type. It would be better if "null" was always returned.