Yes, using ddbDocClient directly from the utility function or passing it down through the parameters from the handler will have the same effect as both ways will involve using the same instance of ddbDocClient to interact with the DynamoDB table. However, passing it down as a parameter may be considered a better practice as it clearly shows the dependencies of the utility function and makes it more modular and reusable.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2022-01-08 11:00:00 +0000
Seen: 10 times
Last updated: Oct 11 '22