Articles
Reset Data In A Vue Component
Data is declared on a vue component using a function that returns the initial data object. Vue will recursively convert the properties of the data object to getters and setters to make it ‘reactive’. It is often useful to be able to reset this data to its original state (the way it was when the component was initialised). It might not be immediately obvious how to do this, so we’ll take a look at two good options.
# 1. Create an initial data function
Thank you for reading this article.
If you've made it this far, you might like to connect with me on 𝕏 where I post similar content and interact with like-minded people. If this article was helpful to you I'd really appreciate it if you would consider buying me a coffee.Prop Destructuring In Vue Js
In a couple of recent tweets, Caleb Porzio demonstrated an easy way to pass Javascript object properties to a child component without declaring a separate prop for each property.
Here's how it works. Let's say that we have a Javascript object with several properties in the data object of a Vue JS component:
Thank you for reading this article.
If you've made it this far, you might like to connect with me on 𝕏 where I post similar content and interact with like-minded people. If this article was helpful to you I'd really appreciate it if you would consider buying me a coffee.Tidying Tips
In a post called The Life Changing Magic of Tidying Up Code, Kent Beck outlines his philosophy on cleaning up code. The article results in a short list of easy-to-follow rules, which I'm sure he would agree are there to be broken.
- If it’s hard, don’t do it
- Start when you’re fresh and stop when you’re tired
- Land each session’s work immediately
- Two reds is a revert
- Practice
- Isolate tidying
Thank you for reading this article.
If you've made it this far, you might like to connect with me on 𝕏 where I post similar content and interact with like-minded people. If this article was helpful to you I'd really appreciate it if you would consider buying me a coffee.Reset Your Laravel App In Seconds
In his recent talk about Laravel Nova at Laracon US, Taylor Otwell used a nice little shortcut to reset his demo app during the presentation. To reset an app in our local environment, we need to do three things:
- Drop the database.
- Migrate the database.
- Seed the database.
Thank you for reading this article.
If you've made it this far, you might like to connect with me on 𝕏 where I post similar content and interact with like-minded people. If this article was helpful to you I'd really appreciate it if you would consider buying me a coffee.Testing Values
There are many ways to test a value in php, some of which can produce confusing results. What’s more, Laravel also offers a couple of helpers which can help us test php values. We’ll go over each method in turn and find out how to avoid some common pitfalls along the way.