question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: strings.split is not a function

See original GitHub issue

Do you want to request a feature or report a bug? buy

What is the current behavior? When renderInnerHtml is set to true and a string with inner html is rendered, it will return TypeError: strings.split is not a function.

Which versions of react and react-localize-redux are you using? “react”: “^16.8.4”, “react-localize-redux”: “^3.5.2”,

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
WillisShekcommented, Nov 19, 2020

For the options that passed to initialize, I have used something like this

const initializeOptions = {
	defaultLanguage, // you default language
	renderToStaticMarkup,
	renderInnerHtml: true,
	onMissingTranslation: ({ translationId, defaultTranslation }) => {
		if (isString(defaultTranslation)) {
			// do anything to change the defaultTranslation as you wish
			return defaultTranslation;
		} else {
			// that's the code that can fix the issue
			return renderToStaticMarkup(defaultTranslation);
		}
	}
};

Hope it can help.

0reactions
andyhbgcommented, Nov 19, 2020

Thank you @WillisShek, it is very helpful!

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is causing the error `string.split is not a function`?
This is because document.location is a Location object. The default .toString() returns the location in string form, so the concatenation will trigger that....
Read more >
[Solved] TypeError: split is not a function - ItsJavaScript
The TypeError: split is not a function occurs if we call a split() method on the value that is not of a type...
Read more >
TypeError: split is not a function in JavaScript | bobbyhadz
The "TypeError: split is not a function" error occurs when we call the split() method on a value that is not of type...
Read more >
How To Fix Split is Not a Function Error in JavaScript - Isotropic
The Problem. First and foremost it is important to understand the usage of the split() method. It can only be used on strings...
Read more >
Error: split is not a function - JavaScript - SitePoint Forums
I have a string that is a latitude and longitude pair separated by a comma. I'm trying to separate the 2 parts of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found