title: Inside callback function - always shows initial state
body: <p>I have a stateful functional react component where I also use sortablejs.</p>
  
  <pre><code>const myComponent = () =&gt; {
    const [myData, setMyData] = useState([...some initial array data...]);
    const testMe = () =&gt; console.log(myData)
    useEffect(() =&gt; {
     const sortableContainer = document.querySelector(".slick-track");
     Sortable.create(sortableContainer, {
          onEnd: () =&gt; testMe() //onEnd is a callback from sortablejs api, that fires after we drag an item
     }, []);
  </code></pre>
  
  <p>And so no matter how myData changes during component life, inside this callback it always shows initial data. So is it possible to get the current <code>myData</code> value inside this callback?</p>