trufflesuite / drizzle

Reactive Ethereum dapp UI suite
906 stars 238 forks source link

Question about the vue plugin documentation #81

Closed Draichi closed 4 years ago

Draichi commented 4 years ago

Is there any example of how can i configure my store on main.js (or in my store folder) ?

in the readme the only information that i have is this:

// Create and configure your Vuex Store
const store = new Vuex.Store({ state: {} })

Can you give me an example of how to this initial state should look like?

thanks

cds-amal commented 4 years ago

Hi @Draichi . The Vuex Store maintains app state as a plain old JS object. Drizzle will maintain its own part of state but the rest of the app state is up to the developer to define. It would depend on how your app defines its own internal state. Take a look at the Vuex guide for how state works

Draichi commented 4 years ago

@cds-amal thanks for you answer

My question was if I have to store the contract instance with a specific name so drizzle can know it. but it seems that drizzle will do that, drizzle itself will store a contract instance on my vuex state ?

thanks again

cds-amal commented 4 years ago

You’re correct. The Vue drizzle adapter will insert its contracts' instances into Vuex from drizzleOptions. The Vuex object should be initialized as necessary for the Vue app.