رقصنده با کد (و غیره)
Open in Telegram
Here are some interesting things I've come across during my learning process. That's it. Admin ID: @alithecodeguy
Show more727
Subscribers
No data24 hours
-47 days
-130 days
Posts Archive
وقتی دارید رشته رو به عدد تبدیل میکنید ، تابعهایی مثل parseInt کاراکتر به کاراکتر پیش میرن و وقتی به یک کاراکتر غیر عددی برسن تا همونجا که تبدیل کردن برمیگردونن ولی عملگر + این کار رو نمیکنه و اگر همه کاراکترها عددی نباشن Nan برمیگردونه.
#js #tip
موقع استفاده از isNan حواستون باشه. از جاهای مختلف بخونید نتیجههای متفاوت میگیرید.
توصیه میشه از Number.isNan استفاده کنید.
#tip #js
برای کداتون تست بنویسید.
حتی اگر فرصت داشتید اول تست بنویسید بعد کد بزنید.
هم برای دنیاتون خوبه هم برای آخرتتون.
منبع همه لینکهای مفید در مورد React در سطح وب :
https://reactresources.com/
چیزی که توی این سایت ، توجه رو جلب میکنه نحوه دسته بندی مطالب هستش.
#react #tip
پست خوبیه.
React Testing Library and Jest both have different responsibilities "react testing library" is not a test runner meaning when u enter command npm test or npm run test it is jest responsibility that collect all the files ending with .test.js and runs each test case and show pass and fail results in your console.
react testing library provides you function to catch dom element and perform some action below are some of its function :
render, fireEvent, waitFor, screen
you can also use Enzyme(another popular testing library) for such function to access dom element
EXTRA: developer often confuse among :
1- jest
2- react-testing-library
3- Enzyme
Here Enzyme and react-testing-library are two similar things and alternatives to each other means you can use :
- enzyme with jest
- react-testing-library with jest
- you can also use all three i.e react-testing-library+Enzyme with jest
https://stackoverflow.com/questions/66341449/testing-library-react-vs-jest
#test #jest
اولویت فایلهای env
بچسبونید جلوی چشمتون. پدرسوخته خیلی اذیت میکنه بعضی وقتا 🥸
برای نفراتی که ریکت رو بلدن و میخوان استارت تایپ اسکریپت رو هم بزنن ، این سایت خوبیه :
https://react-typescript-cheatsheet.netlify.app/
#ts #tip
قطعا میدونید که داینامیک تایپ بودن جاوا اسکریپت تیغ دو لبس. علاوه بر مزیتاش ، جاهایی معایبی هم داره از جمله توی ریکت.
خب حالا چه جوری این داستان رو حل میکنید؟ احتمالا با تایپ اسکریپت.
تایپ اسکریپت فوق العادس و خودش یه زبان حساب میشه. درسته سوپر ستی از جاوا اسکریپته ولی کاملا یه زبان مستقل هستش.
آیا گزینه دیگهای داریم؟ بببله!
عزیز دل ما ، Flow جان!
توسط خود فیس بوک توسعه داده شده و یک زبان مجزا هم نیست.
تایپ اسکریپت خیلی قویتره ولی برای ریکت این فوق العادس.
فرصت کنم مقاله در موردش میذارم.
😍
