//you can write this in your parent component @stack('scripts'),
//and in your child component you can write like this @push('scripts).
//your child component code will be like this
@push('scripts')
<script src="example.js"></>
@endpush
//it will only push the scripts to the parent component when you load the child component.