Can I call associated fields in react-rails components?

Is there a way to get fields from associated model in react components in rails?

I have listing model that I am maping through in react component and getting all the fields within each record including the ID of the model that is associated to listing model that I am getting.

What I specifically want to achieve is to get another field through the associated ID that I have in listing model but, I am not getting it just like we do in rails, for example


How to achieve this?

here a snippet of my code

here is my controller

def all
  @listings = Listing.all
 rescue => e
 @listings = []

def filter
 @listings = Listing.where(nil)

 filtering_params(params).each do |key, value|
   @listings = @listings.public_send(key, value) if value.present?
 render json: { listings: @listings }, status: 200

def filtering_params(params)
  params[:filters].slice(:bedrooms, :bathrooms, :price, :parking)


<%= react_component('ListingsPage', listings: @listings) %>

And here My react component(listings.js.jsx)

class ListingsList extends React.Component {
    constructor(props) {

render() {
  const { listings } = this.props;

return (
  <div className='ListingList_container'>
        <td>Building ID</td>
      {, index) => (
          <tr key={}>
            <td>{index + 1}</td>
            <td>{listing.parking ? 'Available' : 'None'}</td>

            // below I want to get building name just like we do in rails
            // through association '' but, that
            // doesn't work
            <td>{listing.building_id}</td>  // this works, I am getting buikding ID
            <td>{}</td> // this doesn't work

I appreciate every single view and help thanks in advance. Please let me know if my question is not clear.

The solution was to use preloads in my controller