2 ms·
Fun fact- if you're going 100% static then you don't need React, you can just use JS template literals. So instead of this: export const MyComponent = ({ fir
by brundolf 5y ago
Fun fact- if you're going 100% static then you don't need React, you can just use JS template literals. So instead of this:
export const MyComponent = ({ first, last }) =>
<h1>Hello, {first} {last}!</h1>
you'd just do this:
export const myFragment = ({ first, last }) =>
`<h1>Hello, ${first} ${last}!</h1>`
No dependencies (or build steps!) required
- jahewson 5y agoThis stops being fun as soon as you have a user named ‘<script>’
- brundolf 5y agoAny user-entered string data should be sanitized before it enters the DB anyway
- mustardo 5y agoDon't modify input, sanitise output instead. The user entered <script> you should save that verbatim, but there are many output formats, HTML, SQL, PS (Post Script), XLS etc etc where you need to escape user provided values