follow and unfollow node js button
<% if(isLoggedIn) { %>
<% if(user && user._id != currentUser._id) { %>
<% const following = user.following;
const action = following.includes(currentUser._id) ? 'unfollow' : 'follow';
%>
<button class="btn btn-primary ml-4" data-action="<%= action %>" data-follower="<%= user._id %>" data-following="<%= currentUser._id %>" id="follow-btn">Follow</button>
<% } %>
<% } %>
Also in JavaScript:
- jquery hover
- what does the useReducer do in react
- javascript round to 2 digits
- delete with unlinksync node
- javascript queryselector
- webpack proxy
- jquery set href of link
- react disable eslint errors
- class component react
- how to check if a number is even or odd in javascript
- jsdoc for express routes
- new date parameters javascript
- stop a video jquery
- laravel json response
- js object entries
- math.min
- jquery vdn
- git remote url change
- get name of class javascript
- FAILURE: Build failed with an exception react native android
- javascript how to check if object property exists
- modulo operator in javascript
- how to send get request to external server using node
- how to remove background in jquery