score:1
you can make react components without a build step, to do you need to add the following to you html page
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
score:4
in order to upload file on server, you need to have prod build(not necessary but will makes thing light and easy for you).
you can get prod build by running npm build
.
before doing that, make sure your component will be mounted on actual element in your html page. update the following code
reactdom.render(
<your component />,
document.getelementbyid('<id of your element in your pure html page>')
);
now, build your project. a build/static
folder will be created in your project folder. upload that to your server and update your index.html as
in head:
<link href="/static/css/<main css file, actual name can be found in static/css/>" rel="stylesheet">
in body:
<script type="text/javascript" src="/static/js/<main js name found in static/js/>"></script>
Source: stackoverflow.com
Related Query
- Embed a single react component created with create-react-library into html page
- In Webpack 4, can we dynamically generate page chunk with import() token so we can turn a react component into a react-loadable one?
- How to call a full html page into a React component
- Serving a static html page from a single page react app with react router
- Insert React component into a String variable with html content
- Create React Component Library using CRACO with Create React App
- ReactJs - Converting raw HTML with nested React Component into JSX
- React — have active item state stay with menu component when loaded into new page
- Force re-render the react component in the jquery single page application or in static html site?
- Inject React component into html page
- Insert custom React component into a String variable with html content
- Is it possible to embed a dynamic react component into a separate html file without downloading a file or using a server?
- Converting React component to a single js file to integrate it with a blank html
- Importing React component from custom component library into HTML
- How do you export react library component with hooks to use in html file?
- Is there a right way to pass data into a React component from the HTML page?
- add raw HTML with <script> inside Gatsby React page
- Create a static library with React dependency
- How to distribute fonts or other static assets with a React component library built using Webpack?
- How to create a generic React component with a typed context provider?
- How to create a privately shared component library which can be used across multiple react projects
- how to import HTML file into React component and use it as a component?
- How to test Material UI Select Component with React Testing Library
- How to implement the OAuth2 Authorization code grant with PKCE for a React single page application?
- How to read console.log from a mounted component with Enzyme and Jest in Create React App
- Inject a React component into HTML
- How to test HTML content with React testing library
- Single React Component rendering with Babel Standalone with only index.html and Component
- Show all variations of a component on a single page in React Storybook but still have Knobs?
- How to use Turborepo for an existing react app created with Create React App in order to make it a monorepo?
More Query from same tag
- React - Sort by newst date in useState
- React hooks states aren't updating in log
- Component not showing data on pressing back
- How to check if variable not null before adding it as object property?
- React Native Testing Library doesn't find text even though its in debug
- React Semantic UI Input not firing function on backspace pressed
- Redux Thunk Action Creator Not Getting Called
- React fetch posting multiple values under same array
- useState not updated as expected
- Next JS + Contentful: Couldn't fetch params data for getting a Contentful data
- What advantages does useReducer actually have over useState?
- Smaller `Input` in React-Bootstrap
- Error when using useState in official example
- Update an array value with useState's old values
- onClick not working when I attempt to change value of variable
- Is this the correct way of using React.Suspense?
- API call using react Js: TypeError: Cannot read properties of undefined (reading 'map')
- Display domain url in custom Telescope theme
- React useEffect cleanup only on dismount
- Non-sequential event bubbling onClick vs addEventListener
- lodash isEmpty and has method vs simple check
- How can i add React loading spinner when item is fetching from database?
- How to drag a scaled element
- React app state not updating
- How to test a method which is in mapStateToProps in React using Jest - Enzyme
- TypeError: Object(...) is not a function when using react-toastify
- My javascript function works only after I hard refresh the page
- React API Reference
- Searchable dropdown in semantic-ui-react does not immediately display full list of options retrieved from API
- How to call dispatch from onChange in react-router Route?