I'm using express to render a page in my node app and have sent an array to the client-side. I'm wondering how I can display each element as a paragraph in the HTML.
What I tried is below, but it does not work. When my results array is five elements long, I can see in Safari's Inspect Element that five p tags are created but they are empty.
Note that the results array was initiated and populated.
Node:
const app = express();
app.post('/home', (req, res) => {
...
// results array gets populated here
...
res.render('home', {results: results});
});
HTML:
<div class="results">
{{#each results}}
<p>{{r}}</p>
{{/each}}
</div>