4

Could anyone point me in the right direction where i can read about the solution. It works fine in console and lost for ideas at this point.

Promise.all([
    DishSource.getDishDetails(523145),
    DishSource.getDishDetails(787321),
    DishSource.getDishDetails(452179),
]).then((values) =>
    Vue.render(
        <SidebarView guests={5} dishes={values} />,
        document.getElementById("app")
    )
);

SidebarView :

<table>
    {props.dishes.values.map((e) => (
        <tr>
            <td>
                <button> x </button>
            </td>
            <td>{e.title}</td>
            <td>{e.dishType}</td>
            <td>{e.dishPrice}</td>
        </tr>
    ))}
</table>

Error msg + console logs

1 Answer 1

1

At the first rendering dishes property is not available, so you should add some conditional rendering :

{props.dishes && props.dishes.values.map(e => ...
Sign up to request clarification or add additional context in comments.

2 Comments

Should it not wait for the promises to be fulfilled befor it tries to render, if i set the condition it dosnot render at all. Since Vue render is in the "then" statement.
it should render that when the data is available, please share an example in codesanbox

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.