Skip to content

Commit

Permalink
Rewrite context using
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarkelov committed Apr 5, 2019
1 parent 5325cd4 commit dea765a
Show file tree
Hide file tree
Showing 16 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/AllowMessagesFromCommunity.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const AllowMessagesFromCommunity = ({
onAllow,
onDeny
}) => {
const { vk } = useContext(VKContext);
const vk = useContext(VKContext);

useEffect(() => {
vk.Widgets.AllowMessagesFromCommunity(elementId, options, groupId);
Expand Down
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from "prop-types";
import VKContext from "./VKContext";

const Application = ({ elementId, appId, options }) => {
const { vk } = useContext(VKContext);
const vk = useContext(VKContext);

useEffect(() => {
vk.Widgets.App(elementId, appId, options);
Expand Down
2 changes: 1 addition & 1 deletion src/Article.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from "prop-types";
import VKContext from "./VKContext";

const Article = ({ elementId, articleUrl }) => {
const { vk } = useContext(VKContext);
const vk = useContext(VKContext);

useEffect(() => {
vk.Widgets.Article(elementId, articleUrl);
Expand Down
2 changes: 1 addition & 1 deletion src/Auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from "prop-types";
import VKContext from "./VKContext";

const Auth = ({ elementId, options }) => {
const { vk } = useContext(VKContext);
const vk = useContext(VKContext);

useEffect(() => {
const copy = { ...options };
Expand Down
2 changes: 1 addition & 1 deletion src/Comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Comments = ({
onNewComment,
onDeleteComment
}) => {
const { vk } = useContext(VKContext);
const vk = useContext(VKContext);

useEffect(() => {
vk.Widgets.Comments(elementId, options, pageId);
Expand Down
2 changes: 1 addition & 1 deletion src/CommentsBrowse.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from "prop-types";
import VKContext from "./VKContext";

const CommentsBrowse = ({ elementId, options }) => {
const { vk } = useContext(VKContext);
const vk = useContext(VKContext);

useEffect(() => {
vk.Widgets.CommentsBrowse(elementId, options);
Expand Down
2 changes: 1 addition & 1 deletion src/CommunityMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from "prop-types";
import VKContext from "./VKContext";

const CommunityMessages = ({ elementId, groupId, options, onMount }) => {
const { vk } = useContext(VKContext);
const vk = useContext(VKContext);

useEffect(() => {
const widget = vk.Widgets.CommunityMessages(elementId, groupId, options);
Expand Down
2 changes: 1 addition & 1 deletion src/ContactUs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from "prop-types";
import VKContext from "./VKContext";

const ContactUs = ({ elementId, options, ownerId }) => {
const { vk } = useContext(VKContext);
const vk = useContext(VKContext);

useEffect(() => {
vk.Widgets.ContactUs(elementId, options, -ownerId);
Expand Down
2 changes: 1 addition & 1 deletion src/Group.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from "prop-types";
import VKContext from "./VKContext";

const Group = ({ elementId, options, groupId, onJoin, onLeave }) => {
const { vk } = useContext(VKContext);
const vk = useContext(VKContext);

useEffect(() => {
vk.Widgets.Group(elementId, options, groupId);
Expand Down
2 changes: 1 addition & 1 deletion src/Like.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Like = ({
onShare,
onUnshare
}) => {
const { vk } = useContext(VKContext);
const vk = useContext(VKContext);

useEffect(() => {
if (pageId) {
Expand Down
2 changes: 1 addition & 1 deletion src/Playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from "prop-types";
import VKContext from "./VKContext";

const Playlist = ({ elementId, ownerId, playlistId, hash, options }) => {
const { vk } = useContext(VKContext);
const vk = useContext(VKContext);

useEffect(() => {
vk.Widgets.Playlist(elementId, -ownerId, playlistId, hash, options);
Expand Down
2 changes: 1 addition & 1 deletion src/Poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from "prop-types";
import VKContext from "./VKContext";

const Poll = ({ elementId, options, pollId }) => {
const { vk } = useContext(VKContext);
const vk = useContext(VKContext);

useEffect(() => {
vk.Widgets.Poll(elementId, options, pollId);
Expand Down
2 changes: 1 addition & 1 deletion src/Post.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from "prop-types";
import VKContext from "./VKContext";

const Post = ({ elementId, ownerId, postId, hash, options }) => {
const { vk } = useContext(VKContext);
const vk = useContext(VKContext);

useEffect(() => {
vk.Widgets.Post(elementId, ownerId, postId, hash, options);
Expand Down
2 changes: 1 addition & 1 deletion src/Recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from "prop-types";
import VKContext from "./VKContext";

const Recommended = ({ elementId, options }) => {
const { vk } = useContext(VKContext);
const vk = useContext(VKContext);

useEffect(() => {
vk.Widgets.Recommended(elementId, options);
Expand Down
2 changes: 1 addition & 1 deletion src/Subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Subscribe = ({
onSubscribe,
onUnsubscribe
}) => {
const { vk } = useContext(VKContext);
const vk = useContext(VKContext);

useEffect(() => {
vk.Widgets.Subscribe(elementId, options, ownerId);
Expand Down
2 changes: 1 addition & 1 deletion src/VK.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const VK = ({ onApiAvailable, apiId, options, children }) => {
}, []);

return vk ? (
<VKContext.Provider value={{ vk }}>{children}</VKContext.Provider>
<VKContext.Provider value={vk}>{children}</VKContext.Provider>
) : null;
};

Expand Down

0 comments on commit dea765a

Please sign in to comment.