<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Max</title>
    <description>The latest articles on DEV Community by Max (@springathing).</description>
    <link>https://dev.to/springathing</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F286910%2F929218d8-2e0b-4c1e-b159-b56809b569cf.png</url>
      <title>DEV Community: Max</title>
      <link>https://dev.to/springathing</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/springathing"/>
    <language>en</language>
    <item>
      <title>getSnapshotBeforeUpdate property not existent</title>
      <dc:creator>Max</dc:creator>
      <pubDate>Fri, 06 Dec 2019 22:14:38 +0000</pubDate>
      <link>https://dev.to/springathing/getsnapshotbeforeupdate-property-not-existent-33he</link>
      <guid>https://dev.to/springathing/getsnapshotbeforeupdate-property-not-existent-33he</guid>
      <description>&lt;p&gt;I'm attempting to use the method getSnapshotBeforeUpdate and I'm importing react in my file but I'm getting 'property doesn't exist' errors when using the code from React's documentation for maintaining DOM properties between component refreshes.&lt;/p&gt;

&lt;p&gt;listRef = React.createRef();&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;getSnapshotBeforeUpdate(prevProps, prevState) {
    const { current } = this.listRef;
    const isScrolledToBottom = current.scrollTop + current.offsetHeight &amp;gt;= current.scrollHeight;
    return { isScrolledToBottom };
}

componentDidUpdate(prevProps, prevState, snapshot) {
    const { isScrolledToBottom } = snapshot;
    if (isScrolledToBottom) {
        this.listRef.current.scrollTop = this.listRef.current.scrollHeight;
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;My problem is the .scrollTop and .offsetHeight are non existent properties of an unknown type. I was using this documentations: &lt;a href="https://reactjs.org/docs/react-component.html#getsnapshotbeforeupdate"&gt;https://reactjs.org/docs/react-component.html#getsnapshotbeforeupdate&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Any assistance to get these properties to exist is greatly appreciated :)&lt;/p&gt;

</description>
      <category>react</category>
    </item>
  </channel>
</rss>
