'"Expected an assignment or function call and instead saw an expression no-unused-expressions" "while using Optional Chaining"

 useEffect(()=>{
      scrollRef.current?.scrollIntoView({behavior:"smooth"})
  },[messages])

This use hook shows an error while compiling as "Expected an assignment or function call and instead saw an expression no-unused-expressions", the "?" used is -i think- is the cause which is called "Optional chaining" ..Right? im not sure. I couldnt understand what makes this statement doesnt work for me , please help me. every info you pass would be be really greatfull. is it beacuse i miss any npm module?..



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source