Crud operation with same modal

I’m using livewire for a new project so I want my crud operation with modal, in that case, I want to use one modal who responsible for creating and updating like vuejs.

In my blade:
<form class="form" wire:submit.prevent="$editMode ? update : store">

In my component:

public $editMode = false;

 public function store() {
      $this->editMode = false;
      // code here

public function update() {
      $this->editMode = true;
      // code here

Livewire version: 2.x,

can I achieve this…? or I have to use two modal for this…? Thanks in advance

I found a solution on that just like this and you are good to go…

<form class="form" wire:submit.prevent="{{ $editMode ? 'update' : 'store' }}">