user61955: Compare the YouTube video and this webpage, the former one made programming very different in ESP32 and that was in Arduino nano, while the webpage seemed to imply that they work exactly the same. 
Can we use the same code for standard Arduino library, like wire library, for ESP32 and ESP8266, or do we have to do something different?

user70216: Code using the Arduino Wire library is generally portable between processors, but there are pitfalls to watch for.  One that I'm aware of is a difference in the Wire libraries for the ESP32 and ESP8266. The TwoWire::begin() method for the ESP32 has prototype:
bool TwoWire::begin(int sdaPin, int sclPin, uint32_t frequency);

whereas for the ESP8266 it is:
void TwoWire::begin(int sda, int scl, uint8_t address);

So, a call to begin() using the ESP#2 library will set the clock using the third parameter, whereas on the ESP8266 it will truncate the third parameter and use it as an address.
If you wish code to be portable between the ESP32 and ESP8266, then the fix for this particular issue is to call TwoWire::begin( my_SDA_pin, my_SCL_pin ) (specifying only two parameters:the SDA and SCL pins), and use a separate call to TwoWire::setClock( my_clock_speed ) to set the clock.
There may be other differences I'm not aware of...

61955: <p>Compare the <a href="https://www.youtube.com/watch?v=HwurH20jsvw" rel="nofollow noreferrer">YouTube video</a> and <a href="https://randomnerdtutorials.com/esp32-i2c-communication-arduino-ide/" rel="nofollow noreferrer">this webpage</a>, the former one made programming very different in ESP32 and that was in Arduino nano, while the webpage seemed to imply that they work exactly the same. </p>

<p>Can we use the same code for standard Arduino library, like wire library, for ESP32 and ESP8266, or do we have to do something different?</p>
 70216: <p>Code using the Arduino Wire library is generally portable between processors, but there are pitfalls to watch for.  One that I'm aware of is a difference in the Wire libraries for the ESP32 and ESP8266. The TwoWire::begin() method for the ESP32 has prototype:</p>
<pre><code>bool TwoWire::begin(int sdaPin, int sclPin, uint32_t frequency);
</code></pre>
<p>whereas for the ESP8266 it is:</p>
<pre><code>void TwoWire::begin(int sda, int scl, uint8_t address);
</code></pre>
<p>So, a call to begin() using the ESP#2 library will set the clock using the third parameter, whereas on the ESP8266 it will truncate the third parameter and use it as an address.</p>
<p>If you wish code to be portable between the ESP32 and ESP8266, then the fix for this particular issue is to call <code>TwoWire::begin( my_SDA_pin, my_SCL_pin )</code> (specifying only two parameters:the SDA and SCL pins), and use a separate call to <code>TwoWire::setClock( my_clock_speed )</code> to set the clock.</p>
<p>There may be other differences I'm not aware of...</p>
