Guest User

Untitled

a guest
May 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. ### JSX
  2.  
  3. ```jsx
  4. <Window content={
  5. <div>
  6. <h1>Hello!</h1>
  7. <button onClick={function () { alert("why not onclick?!"); }}>Click me!</button>
  8. </div>
  9. } />
  10. ```
  11.  
  12. Why is it `className` and `htmlFor` and why `onClick` and why does `onChange` get remapped to `oninput`? But I have to admit it's nice that at least whatever is in braces is actual JavaScript and some other framework-specific derivative of it, as it is for the next one ...
  13.  
  14. ### Riot
  15.  
  16. ```html
  17. <h3>{ opts.title }</h3>
  18.  
  19. <ul>
  20. <li each={ item, i in items }>{ item }</li> <!-- the argument to each is definitely not JS -->
  21. </ul>
  22.  
  23. <form onsubmit={ add }>
  24. <input ref="input">
  25. <button>Add #{ items.length + 1 }</button> <!-- why is it #{} here and {} for the h3? -->
  26. </form>
  27. ```
  28.  
  29. ### Vue
  30.  
  31. Messing with attribute values is definitely not enough though. Let's prefix attribute names with funny sigils:
  32.  
  33. ```html
  34. <textarea :value="input" @input="update"></textarea>
  35. ```
  36.  
  37. But at least some things are admittedly solved with well formed XML:
  38.  
  39. ```xml
  40. <div v-bind:id="dynamicId"></div>
  41. ```
  42.  
  43. Where others just go bonkers ...
  44.  
  45. ### Angular
  46.  
  47. Until you've seen Angular, you ain't seen nothing:
  48.  
  49. ```html
  50. <div *ngFor="let hero of heroes">{{hero.name}}</div>
  51. <input #heroInput> {{heroInput.value}}
  52. <button [hidden]="isUnchanged" (click)="deleteHero()">Delete</button><!-- What does this even mean? -->
  53. ```
Add Comment
Please, Sign In to add comment