Log in
Sign up
Overview Questions Answers

Nick

nick

    Stats

    • 256 reputation
    • 61 questions asked
    • 167 answers
    • 76 selected answers
    Overview Questions Answers
    • Newest Questions 61
    Access array item at index in handlebars?
    Asked 3 months ago by nick · Unansweredhandlebarsjavascript
    1
    Disable workbox console log message?
    Asked 5 months ago by nick · Unansweredjavascript
    1
    Remove "'process' is not defined" ESLint warning in Next.js?
    Asked 5 months ago by nick · Unansweredjavascripteslintnext.js
    1
    Have git show the number of modified lines before creating a commit?
    Asked 6 months ago by nick · Unansweredgit
    1
    Support tables when using ReactMarkdown?
    Asked 1 year, 1 month ago by nick · Unansweredmarkdownreactjavascript
    1
    View more →
    • Newest Answers 167
    Access array item at index in handlebars?

    {{ screening.patient_info.phones.0.number }} where 0 is index position.

    Answered 3 months ago by nick
    Disable workbox console log message?

    self.__WB_DISABLE_DEV_LOGS = true

    Answered 5 months ago by nick
    "'Window' is not defined` ESLint warning in Next.js app?

    You want the environment: browser that includes window.

    Update the env section of your .eslintrc.js file to include it:

    env: { browser: true, }, Since Next.js runs code in both the browser and server (Node.js) environments, you'll want both node and browser environments:

    env: { node: true, browser: true, },

    Answered 5 months ago by nick
    Use an if else statement in a Handlebars (.hbs) file?

    In Handlebars, you can do something like this:

    <td>
      {{#if condition}}
        <button>Is Owner</button>
      {{else}}
        <button>Not Owner</button>
      {{/if}}
    </td>
    

    Based on the condition value you pass to the template, one or the other version of the button will be used.

    Answered 1 year, 4 months ago by nick · Selected answer
    Only show an element if it's NOT true in Handlebars?

    You're looking for the {{#unless}} helper. It serves as the inverse of the if helper you're attempting to use.

    You could use it like this in your Handlebars code:

    {{#unless condition}}
      <button>Submit</button>
    {{/unless}}
    

    This would show the <button> element when the condition you provide to the helper is falsey. Otherwise, it would render nothing.

    Answered 1 year, 4 months ago by nick · Selected answer
    View more →
    • Terms
    • Privacy

    © 2023 Chunkks