H
H
Hellas2017-03-03 19:24:30
JavaScript
Hellas, 2017-03-03 19:24:30

How to render on the server side?

It is necessary to render the result of the function _userson the server side.
Is it possible for the server to take this function from client scripts, and, substituting the necessary data, return HTML?

export function _users(usersData) {
  return (
    `
    <ul class="users-list">
      ${_user(usersData.uids)}
    </ul>
    `
  );
}

export function _user(uids) {
  return uids.map((uid) =>
    `
    <li class="user-item">
      ${uid}
    </li>
    `
  ).join('');
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan, 2017-03-03
@LiguidCool

Template engine to help you. Handlebars for example or Jade.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question