0

I have no idea what ?. means. Example:

 React.useEffect(() => {
    if (route.params?.post) {
      // Post updated, do something with `route.params.post`
      // For example, send the post to the server
    }
  }, [route.params?.post]);

It's hard to google the answer. I just see articles on the conditional (ternary) operator.

Joshua Augustinus
  • 532
  • 1
  • 5
  • 13
  • 2
    It's [Optional_chaining](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Optional_chaining) – Reyno Aug 19 '20 at 14:05
  • @jonrsharpe that duplicate link links to another closed question, not the original :) – Dan Aug 19 '20 at 14:06
  • 1
    _“It's hard to google the answer.”_ - not if you do it right. “javascript question mark followed by dot” led to https://stackoverflow.com/questions/15260732/does-typescript-support-the-operator-and-whats-it-called in no time. – CBroe Aug 19 '20 at 14:07
  • And your question title typed into Google _verbatim_, would’ve also relatively easy found https://stackoverflow.com/questions/61847231/question-mark-before-dot-in-javscript-react – CBroe Aug 19 '20 at 14:09

0 Answers0