I am new to React, I have gone through the official React tutorials on how to use React as a standalone service and have just gone through this tutorial on using the react-rails gem in a Rails App, which for the most part I have appropriated to be exactly what I need. The problem I'm encountering is that I need to implement some sort of simple API polling for my little React page, but I can't seem to find documentation anywhere on how to best implement this in react-rails.
During the react tutorial it tells us to use pollinterval = 2000
when declaring the data source to poll the source every 2000 milliseconds. I tried implementing this as follows, but to no avail:
@Records = React.createClass
getInitialState: ->
$.ajax
method: 'GET'
url: '/records'
dataType: 'JSON'
success: (response) ->
records: response
pollinginterval: 2000
...
Unfortunately when I load the page not only does no content actually display, but it appears to not be querying the database at all - even initially. This leads me to believe that this is not the proper location for the AJAX call / setting the pollinginterval, but nothing in my googling has been particularly helpful.