Then after using this command to run the application
#run app
yarn start
after that, we will get our fresh newly react app in the browser as shown below.
Now we open index.js file that is being looked like this
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
reportWebVitals();
Now we modify the script for performing our target task that is to implement useRef
As we have earlier mentioned that useRef manipulates DOM elements. So, here we declare a few DOM elements like h1 and input as shown in the below code.
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
// import App from './App';
import reportWebVitals from './reportWebVitals';
const App = () => {
return (
<>
<h1>This is UseRef Example</h1>
<input type="number" />
<button>Submit</button>
</>
)
}
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
reportWebVitals();
After changing the inside code our screen will be look like this
Then after we will define a state and useRef variable as mentioned in code below.
After Declaring that we will create a function that will be called after the button is clicked. In side that function we have also printed useRef value and we will check what will be the output?
Today Social media is a huge source for data. And in 21 century we know the importance of Data. 21 is the age of Data in this business starts from data, business grow from data and business also collapse in the absence of Data, even in this age idea come from data.
Some advantages of Social media information
Setting goals on the basis of trends
Knowing about the market from our actual customers
Feedback of our product
Generating ideas on the basis of customers
This is the reason which today’s business leaders are more interested in mining Data in comparison to mining the earth.
Now, people are interested in extracting information form Data in comparison to extracting minerals from earth.
Facebook and twitter are giants in the social media industry. Both have a huge amount of live data as well as historical (approx 10 old data).
So today we will learn some tips for extracting information from facebook and twitter.
At first, we will go for facebook then we will also discuss some tips for extracting information from twitter.
Data Extraction from facebook
Facebook is a huge source of live data as well as historical data (approx 10 years old). facebook data also helps us in making business decisions or understanding market trends.
Rfacebook package is used for extracting information from facebook after accessing facebook API functions using R language.
This package provides a series of functions that help us (R developers) to access facebook API and getting these following information
Users and posts
Get public information
Get public page details
And much more information we can be able to collect from facebook.
But before accessing facebook API using Rfacebbok package we need to generate auth token from developer facebook website after which facebook authenticates us for using their API.
So for generating auth token we have to follow these few steps as shown below.
Step 1: Goto this link (After login from your facebook account)