#function in template- expert question

3 messages · Page 1 of 1 (latest)

drowsy nacelle
#

(1)

@Pipe({ name: 'plusOne', standalone: true })
export class PlusOnePipe implements PipeTransform {
  transform(value: number): number {
    return value + 1;
  }
}

<div>{{ count | plusOne }}</div>
<button (click)="count = count + 1">Increase</button>

(2)

<div>{{ plusOne(count) }}</div>
<button (click)="count = count + 1">Increase</button>

count = 0;
plusOne = memo((count: number) => count + 1);

in an article, I read that method 2 is better but I did not understand why
especially since I often read that we don't use d function in the template

#

function in template- expert question

wise flax
#

can you share the article? it's also not clear what memo() is