Accessing object from renderHits with instantSearch.js

Hello,

I want to access the object values ​​through the render function in order to display the values ​​in a table.

// Create the render function
const renderHits = (renderOptions, isFirstRender) => {
    const { hits, widgetParams } = renderOptions;

    widgetParams.container.innerHTML = `
    <tr>
      ${hits
        .map(
            item =>
                `<tr>
                    <td>
                        ${instantsearch.highlight({ attribute: 'name', hit: item })}
                    </td>
                    <td>
                        ${instantsearch.highlight({ attribute: 'nationality_text', hit: item })}
                    </td>
                    <td>
                        // languages is an object, i want to access to languages.language_text
                        ${item.languages}
                        
                        // Output in my HTML : 
                        // [object Object]
                    </td>
                 </tr>`
        )
        .join('')}
    </tr>
  `;
};

Capture d’écran 2022-02-21 à 11.19.02

Thank you very much in advance for your help

1 Like