Hey would like to know the reason :)
Why import the useStore function instead of importing directly the /store/index.js file
https://next.vuex.vuejs.org/guide/composition-api.html
Seems like it does the same
useStore uses inject (provide/inject api) to access the store. This means that passing the store from another file/dependency is not needed. It is preferred only because it is consistent thematically with the composition API (hooks).
Related
I have a dynamodb table that was created via console and I want to enable multi-region support by adding to the list of replicationRegions using CDK.
After importing the original table using:
const table = Table.fromTableArn(this, "ImportedTable", "arn:aws:dynamodb...");
I realized I did not have access to the tables replicationRegions field as I would when creating new one.
Is there a way add to the list of replicationRegions on an imported dynamodb table using CDK?
Yes, but use cdk import instead of Table.fromTableArn.
The fromSomethingArn-type methods create *read-only* references to an external resource.* You can't use these to modify a resource. The ISomething interface constructs these methods return are useful for things like creating new permissions and targets.
The cdk import command is preview functionality to properly import existing resources into a CDK stack. A DynamoDB Table is a resource type that supports import operations. Once this one-time import completes, the "adopting" CDK stack can modify the "imported" table like any other, say, by adding replication regions.
In other words, The CDK can only modify resources it owns. To make ad-hoc modifications to an existing resource without permanently "adopting" it, use the SDKs instead.
* Earlier versions of the CDK docs did call these from... methods "importing" operations, but have been updated to use the less ambiguous term "referencing".
How to Import an existing smart contract into new collection on opensea?
It seems the function is close.
Thx
I try to find some API, but failes
I am new at using cloud firestore and Vue.
I am trying to use custom key, instead of it's generated Id.
I tried using set()
But, received error:
set() is not a function
Can someone help out, how to use it in Vue?
Thank you in advance
Assuming you have a ready project and imported the JS SDK and the firestore package:
import firebase from 'firebase/app';
import 'firebase/firestore';
First, declare a reference to a collection
const ref = firebase.firestore().collection('cars')
Then, you can set a new document passing an object to the set() function
ref.doc('my_custom_key').set({color: 'red'})
Is it possible to export and import Flow type definitions in CommonJS world similarly to ES6 like type imports/exports?
There is no CommonJS-style require for Flow, but Flow's import type/export type syntax can be used alongside CommonJS require calls.
Though the syntax looks similar, import type and export type are not actual JavaScript import/export statements. They must be stripped from your code before your code can be run in current browsers. If you use Babel to compile your code, for example, you use the transform-flow-strip-types plugin to strip Flow types and type imports/exports.
I am using angular2-meteor.
When I try to pass a value between two components (when the value change in the first component, create an event in second component and use this new value), I have two ways right now:
One way is meteor way: using this.autorun and Session.get.
Another way is angular2 way: using Injectable service with EventEmitter.
Which way should be prior? Or is there any other better way? Thanks
Now I used angular2-meteor a while.
Although the angular2-meteor tutorial has no example so far about using or choosing Angular 2 service or Meteor Session.
But I feel angular 2 takes the lead in the front end, while meteor makes reactivity easier and also handle all back end things.
So I went with angular2 way using service to share between components. And service is very powerful like #todd-w-crone said.
If anyone has better answer, I will switch to accept that one.
I find it practical to create a new service called App.states.ts which is accessed globally and mimics Session (get / set).
I commonly import this service to all necessary components to get or set new value such as User.status, company.profile, lastProduct, etc.
Since this service is #injectable it can also make use of other services, in case a value hasn't been set already.
This allows me to ask for a variable in a component appState.getLastModifiedItem(), then in app.states.ts I'll write this function to pass this.modifiedItem or either:
Request another service item.service.ts to fetch data
Call another function with itemCollection.findOne({...}) and return such value.
You can configure Mongo queries as you want and either store static data in appState or keep subscription items in appState.
Do take into consideration that all subscriptions handled by an #injectable within a component are imported by such component. Be wary of conflicting subscriptions between components/services.