Skip to content

What's the difference? #5634

Answered by RanVaknin
tahamansoor asked this question in Q&A
Jan 2, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hi @tahamansoor ,

The main differences between the two import methods is syntax and structure. Both achieve similar outcomes, but they cater to different coding styles.

When you use:

import { DynamoDBClient } from '@aws-sdk/client-dynamodb';

You're taking advantage of JS SDK v3's modular approach. Here, you directly import the client and then utilize it to send commands. For instance:

import { DynamoDBClient, PutItemCommand} from '@aws-sdk/client-dynamodb'; // adding here each command you want to use.

const client = new DynamoDBClient(/* config */);
client.send(new PutItemCommand(/* command parameters */));

On the other hand, the following import:

import { DynamoDB } from '@aws-sdk/clien…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tahamansoor
Comment options

Answer selected by RanVaknin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants