Vanilla ReactJS include sub component in JSX file -


good morning. i'm attempting use vanilla react (without use of nodejs) add in components our existing site.

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.1/react.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.1/react-dom.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser.min.js"></script> <script type="text/babel" src="./js/react/src/contact_form.jsx"></script> 

working nodejs using eg. var button = require("./button"); within .jsx file include additional sub components.

is there way vanilla react accomplish this?

for example:

index.html -> form.jsx -> (input.jsx, select.jsx, button.jsx)

components objects / functions can put them in shared namespace.

window.reactcomponents = window.reactcomponents || {} window.reactcomponents.button = props => <button /> 

then in other file:

var button = window.reactcomponents    ? window.reactcomponents.button   : <span />  var coolbutton = props => <button style={{ color: 'blue' }} /> 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -