I have summarized and compiled a list of React.JS best practices from various sources across the internet.
Предположим, у меня есть список айтемов, где у каждого, например, есть кнопка удаления. По нажатию на кнопку просто вызывается какая-то функция, которая работает с backend API.
function ListItem({ data }) {
return (
<li className="list-item">
{/* ... */}
We need to create an app to review movies from The Movie Database API.
- Use The Movie Database API(DOCS), we want to see your work with real data.
- On the Homepage, we should see a list of popular movies. There should be pagination or infinite scroll.
- When the user clicks on a movie card in the list, we go to the page where we will see detailed information about the movie.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.rounded-corners-gradient-borders { | |
width: 300px; | |
height: 80px; | |
border: double 4px transparent; | |
border-radius: 80px; | |
background-image: linear-gradient(white, white), radial-gradient(circle at top left, #f00,#3020ff); | |
background-origin: border-box; | |
background-clip: content-box, border-box; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function bar() { | |
await new Promise(r=> setTimeout(r, 1000)) | |
console.log('bar'); | |
} | |
async function bam() { | |
await new Promise((ignore, reject)=> setTimeout(reject, 2000)) | |
.catch(()=> { console.log('bam errored'); throw 'bam'; }); | |
} | |
async function bat() { | |
await new Promise(r=> setTimeout(r, 3000)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sendNotification('Верните Линуса!', { | |
body: 'Тестирование HTML5 Notifications', | |
icon: 'icon.jpg', | |
dir: 'auto' | |
}); | |
function sendNotification(title, options) { | |
// Проверим, поддерживает ли браузер HTML5 Notifications | |
if (!("Notification" in window)) { | |
alert('Ваш браузер не поддерживает HTML Notifications, его необходимо обновить.'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://sarcadass.github.io/granim.js/examples.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://codepen.io/foleyatwork/pen/HAomG/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
label | |
position: relative | |
width: 10px | |
height: 10px | |
display: block | |
input[type="checkbox"] + span | |
position: absolute | |
left: 1px | |
top: 5px | |
width: 11px |
NewerOlder