Instructor: First, let's create a new React app with npm init react-app in the name of your application. I'll call it CRA2-SVG. Immediately, cd into the app after it's bootstrapped. Once everything is created, then open our VSCode with code period and start the React dev-server with npm start.
Open the app JS file which is the code for the app running on the right. Right now, the import of the log SVG on line 2 returns the file name that could be used as the source of an image like on line 10.
However, in React app 2.0you could also import a wrapped React component version of the SVG, and rename it to something else. We'll call it React logo. Then, you could use this component as you would any other React component.
When you save, you'll see it render on the right. The SVG is quite large, but that's OK. Now, you could come back and add the class name and all props, and it will be applied just like the image above. Now, our image and React logo component look the same.
However, if we inspect the elements in our dev tools, you'll notice a distinct difference. The image renders as an image element, but the React logo actually renders as an inline SVG, and you could dive in and see the G in path elements.
The cool thing about this difference is that, with an inline SVG, you can actually style it via CSS. If you open the app CSS file, you can add a new rule set for app logo and target the G element.
We'll change the fill color to salmon and save, and now our logo is salmon. Let's go a bit further. We'll now target the path element inside the app logo, and change the stroke to pale goldenrod, and change the stroke width to 10 pixels, and a fill of none, and a stroke-array describing a length of 35 pixels with a gap of 15 pixels.
Then, add an animation with the name of orbit, a one second duration, and iteration count of infinite and a linear timing function, which means we'll need to define an animation with key frames name of orbit. We'll animate to a stroke-offset of 50 pixels, which is the sum of the dash array.
Now, our dashes are animating. The build it inline SVG really opens up the opportunity to be able to customize and theme SVGs across your application.