Refresh/Get lasted Rails data for React?

I need to get my coin price data from my Mongo database to react through Rails. This is my controller

class StaticPagesController < ApplicationController
  def home
    pricedata = Mongoid::Clients.default
    @coin_prices = pricedata[:prices].find().to_a

In home.html.erb , I get the React function like that

<div class="row">
  <%= react_component("CoincapList" , coin_prices: @coin_prices ) %>

The problems is : every 10s my mongod data will be updated (get new price) , so is there anyway I can refresh my database on react component each 10s ?



comments powered by Disqus